searching for elements and deleting them in an array

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

It is much easier for everyone else if you insert your data as text, and not as an image, then we do not need to type it all in again. Code should be formatted using the {} Code button that you will find above the textbox.

Sign in to comment.

Answers (1)

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.

Categories

Find more on Graphics Objects in Help Center and File Exchange

Asked:

on 31 May 2015

Edited:

on 1 Jun 2015

Community Treasure Hunt

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

Start Hunting!