Hi,
I have the following code
for k = 1:length(yarray)-1 if yarray(k+1) <= A & yarray(k) >= A M = [yarray(k) yarray(k+1) k k+1] elseif yarray(k+1) >= A & yarray(k) <= A M = [yarray(k) yarray(k+1) k k+1] end end
Where yarray is an array of y values in a plot, and A is the y value that I want to find corresponding x values to. I am expecting the if and elseif conditions to be satisfied 4 times, resulting in 4 M arrays. However, each time this is satisfied, M is overwritten. How can I come up with 4 different arrays which I can recall later?Let me know if this needs more clarification. Thanks!
Best Answer