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 Comment

Jan1989 seems to have strings and Var2,Var4 and Var5 seem to be NaNs

Sign in to comment.

 Accepted Answer

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 Comments

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.)
.
Pul
Pul on 21 Jul 2021
Edited: Pul on 21 Jul 2021
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).
.
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!
.

Sign in to comment.

More Answers (0)

Asked:

Pul
on 21 Jul 2021

Commented:

on 21 Jul 2021

Community Treasure Hunt

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

Start Hunting!