Strange error with plot

I came across a curious error and I'm trying to figure out why this is happening.
I have a vector, date, and a 3-D array, TimePortStats. I'm trying to plot this:
plot(date(t_reg+1:end), TimePortStats(t_reg+1:end,j,k));
But I get this error:
Error using plot
Not enough input arguments.
Now instead, if I do this:
date(t_reg+1:end);
TimePortStats(t_reg+1:end,j,k);
plot(date(t_reg+1:end), TimePortStats(t_reg+1:end,j,k));
It plots fine. Why?

1 Comment

Hi Jiann,
Are you running these lines in a script or in the Command window? I tried something similar and it runs fine for me. I was not able to reproduce the error.
date = rand(1,5);
TimePortStats = rand(5,5,5);
t_reg = 1;
j = 2 ;
k = 3 ;
plot(date(t_reg+1:end), TimePortStats(t_reg+1:end,j,k));
You can see the Figure plot made by running the above code, attached here.
Can you post the M files and/or data, that you are using, so that we can take a better look at this error and try to reproduce it?

Sign in to comment.

Answers (0)

Asked:

on 11 Aug 2015

Commented:

on 13 Aug 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!