Removing a Range of Elements from an array
73 views (last 30 days)
I have a matrix M and I am interested in the 12th column which has elements [1 2 3 4..... 540 589 760 761 770 47 46 47 48]
My goal is to get rid of all the elements after 750, including the values less than it.
My first code was
but this didn't get rid of 47 46 48..
Mxmin=min(Mx); %to find the smallest value above 750 (in this case 760)
currently I am using this code, which gives me an error that says A null assignment can have only one non-colon index.
What am I doing wrong?
More Answers (1)
Jos (10584) on 28 Mar 2019
ix = find(M(:,12) > 750, 1, 'first') % find the row index of the first element in the 12th column of A being larger than 750
M(ix:end,:) =  % remove all the rows of M starting with this row