I’m doing data analysis in Matlab, and I have two columns. I’m using find(column1>0) to find the positive values of the first column in a data set. Now, I want to plot (column1,column2), but it is of course not possible, as the size is not the same. The question:
How do I get the corresponding values in column2 for the positive values in column1? Like, if row 17 and row 42 have a positive value in column1, how do I find the value of row 17 and row 42 in column2?
The term for what you are doing is indexing. You can use
find, which generates linear indices, but you shouldn’t in this case. Logical indexing is more appropriate.