WHY DO I GET THIS ERROR USING THE ERROR BAR AND PLOT?
显示 更早的评论
Hello,
does anyone know why I get this error: "Input arguments must be numeric, datetime, duration or categorical"?
Thank you.
1 个评论
Jan1989 seems to have strings and Var2,Var4 and Var5 seem to be NaNs
采纳的回答
The errorbar call should be:
errorbar(x, MODESTAMMEQ.Var5, MODESTAMMEQ.Var4,'.r','MarkerSize',6)
since ‘MODESTAMMEQ.Jan1989’ (that likely threw the error) has to be processed in the regexp and datetime calls to be usable as ‘x’.
However the ‘MODESTA’ table does not exist, so the second plot call does nothing, and substituting:
plot(x,[y, MODESTAMMEQ.Var5]);
gives a very strange result (at least to me).
.
8 个评论
I tried in this way and it works:
load('MODESTA_MMEQ_STAKES');
errorbar(x,MODESTAMMEQ.Var5(:,1),MODESTAMMEQ.Var4(:,1),'.r','MarkerSize',6)
hold on
plot(x,[y, MODESTAMMEQ.Var5(:,1)]);
hold on
But if I go to plot the error bars with different colors, I can't see the "y" and I lose a value (in the plot before I have 15 values while in this one I get 14 values).
errorbar(x(5432:6513,1),MODESTAMMEQ.Var5(5432:6513,1),MODESTAMMEQ.Var4(5432:6513,1),'.r','MarkerSize',6);
hold on
errorbar(x(7639:10569,1),MODESTAMMEQ.Var5(7639:10569,1),MODESTAMMEQ.Var4(7639:10569,1),'.b','MarkerSize',6);
hold on
errorbar(x(10570:11266,1),MODESTAMMEQ.Var5(10570:11266,1),MODESTAMMEQ.Var4(10570:11266,1),'.m','MarkerSize',6);
hold on
plot(x,[y, MODESTAMMEQ.Var5(:,1)],'g');
Thank you!
My pleasure!
All 15 plot for me.
In chronological order (left to right), the first 5 are red, the next 9 are blue, and 1 magenta at 4 Nov 2019, at the far right edge of the plot. These add to 15, so they all plot for me. (It may be difficult to see the magenta one if it plots on the right edge of the plot and overplots the plot border.)
.
But I can't see the y values (trend), but I would like to see them!
I can only see the data with error barr.
Is it the same for you?
I am not certain what you are referring to.
With this code:
figure
hold on
errorbar(x(5432:6513,1),MODESTAMMEQ.Var5(5432:6513,1),MODESTAMMEQ.Var4(5432:6513,1),'.r','MarkerSize',6);
errorbar(x(7639:10569,1),MODESTAMMEQ.Var5(7639:10569,1),MODESTAMMEQ.Var4(7639:10569,1),'.b','MarkerSize',6);
errorbar(x(10570:11265,1),MODESTAMMEQ.Var5(10570:11265,1),MODESTAMMEQ.Var4(10570:11265,1),'.m','MarkerSize',6);
plot(x,[y, MODESTAMMEQ.Var5(:,1)],'g')
hold off
I get this plot:

Everything appears to be there (even though I do not understand the discrepancy between the errorbar plots and the green ‘Var5’ lines).
.
What do you mean?
The green line and all the error bars appear to be present.
I simply do not understand the differences between the blue error bars and the green line, when the others appear to be on the green line, since I do not understand what the plots represent. I assume that they are correct, however.
.
Ah, okay, I got it!
It's correct they are in that way.
Thank you very much for your help!
As always, my pleasure!
.
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
