I've been getting an error when I try to subplot in my function, so I tried the EXACT code found in the subplot doc as an example, and still got the same error.
The error is "Index exceeds matrix dimensions"
Or, if I'm running the debugger it says "Attempted to access subplot(2,1,1); index out of bounds because size(subplot)=[1,1,1]."
Here's the example:
x= linspace(0,10)
y1=sin(x)
y2=sin(5*x)
figure
subplot(2,1,1);
plot (x,y1)
subplot(2,1,2);
plot (x,y2)
Best Answer