Delete specific rows on a large matrix?

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?

回答 (1 件)

Abdulrahman Abdulaziz S Aljurbua
Abdulrahman Abdulaziz S Aljurbua 2020 年 6 月 2 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

質問済み:

2018 年 1 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by