searching for elements and deleting them in an array
1 view (last 30 days)
Show older comments
Hi ! I have the next array:
the mission is for matlab locate all the rows with non real compenents or zeros and delete their respective rows
for example in the above array, rows: 1,2,3,6,7,8,9 should be deleted. thanks!(im using matlab R2007b)
1 Comment
Answers (1)
dpb
on 31 May 2015
ix=any(imag(x)~=0 | x==0,2);
x(ix,:)=[];
You can, of course, combine the logical expression into the subscript and thus eliminate the temporary.
0 Comments
See Also
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!