Hi,
I have a v = 2x30 matrix and I need to take make another matrix to take all points of v whose y coordinates are positive
Hi,
I have a v = 2x30 matrix and I need to take make another matrix to take all points of v whose y coordinates are positive
I suggest that you read the documentation on matrix indexing, and specifically the part about logical indexing. I believe the solution you're looking for is something like this:
vSub = v(:,v(2,:) > 0); %# Extract columns where the second row is > 0
vPos = v(:, v(2,:) > 0);
creates the 2-by-n submatrix you described.