To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
INTRO: I have an array M as below:
M= 1 4 2 NaN 3 10 4 NaN 5 NaN 6 15 7 NaN 8 17 9 59 10 NaN
GOAL: I want to plot the second versus the first column as follow:
PROBLEM: Due to the NaN, it does not plot the gaps correctly and breaks the continuity of the graph.
I wonder if someone could suggest me to some command lines that could fix this issue.
I thank you in advance for your help
You can interpolate to fill the missing values, as Azzi suggests, or simply remove all the NaNs:
idx = ~isnan(M(:,2)); x = M(idx,1); y = M(idx,2); plot(x,y,'o-')
If you don't plot markers on the data points, this will look exactly the same as Azzi's solution using interpolation. The difference is whether or not you care about showing which points are actual data values.