Deleting rows in Matlab
1 回表示 (過去 30 日間)
古いコメントを表示
I have a large column vector (col1) I have the following code:
notcontacts=(col1(:,1)>600);
col1=col1.*notcontacts
Now I want to to delete all of the zeros that are in the column of data so i have the following (col2) which is only made up of the values that are greater than less than 600.
3 件のコメント
回答 (1 件)
Oleg Komarov
2012 年 5 月 9 日
EDITED
idx = idx = col1(:,1) < 600 & col1(:,1) ~= 0;
col2 = col1(idx, 1);
4 件のコメント
Geoff
2012 年 5 月 10 日
@Oleg : You forgot the removal of zeros:
idx = col1(:,1) < 600 & col1(:,1) ~= 0;
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!