Delete specific rows on a large matrix?
Show older comments
Hello everyone,
I need some help, on a problem which looked pretty basic at the beginning. I have a very big matrix with 10947479 rows and 3 columns. But I don't need the values above 200 and it should remove the whole row. I tried like below:
idx = V1(:,2) >= 200;
V1(idx,:) = [];
Unfortunatly, the result is very bad. In the matrix are zeros now, while in the original matrix are none zeros at all. If I run the code like this:
V1(idx(1:10000),:) = [];
it works as supposed. I don't no why :( Does anyone know how I can solve my problem?
Answers (1)
Abdulrahman Abdulaziz S Aljurbua
on 2 Jun 2020
0 votes
Hi ..
Did you try:
V1(201:end,:) = 0
This is supposed to make any row below the 200th enrty = 0.
or
V2 = V1(1:200,:) ;
This will store the value of the first 200 rows ov V1 in V2.
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!