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 个评论

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?

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by