How to save specified data from a matrix?
5 views (last 30 days)
I am wondering how can I delete specified data from a data matrix. For example, if I have a matix like this:
How can I save a matrix that satisfy this : for each row, each element is smaller than a specified number such as 0.200.
I know I can use indice, eg. ind=find(m(:,2:5)< 0.2)
but I can't save it by using m1=m(ind,:)
I guess the problem is the number of rows is changing when I use m1=m(ind,:).
does anyone know how can i achieve this?
More Answers (1)
Babak on 27 Aug 2012
if your matrix m is 100 by 1, you can do this:
gives you a new matrix that is smaller or equal size to the original matrix.
For a 100 by 5 m, I think you can write a for loop on the different columns of m,
a = m<.2;
m(a(:,j)) % gives you the elemets of m(:,j) that are less than 0.2