Why is errorbar plotting returning error when all inputs are doubles?

Hello,
I am attempting to plot a years worth of data in hour incriments, with the time on the x axis and the units of my data on y. I have a value of error for each hour point, and the code for the data plot is
errorbar(datetime(data(:,1:6)),data(:,7), data(:,8))
datetick('x','mmm')
Where the data looks like this
And it gives the error
Error using errorbar (line 76)
Input arguments must be numeric or objects which can be converted to double.
I am very confused as the data is in a double, and it has no problem plotting without the errorbars if I just use the code plot(datetime(data(:,1:6)),data(:,7)).
What can I do to make this plot with the error bars? I have tried assigning them as x, y, err outside of the function, but that also didn't work.
Thank you for any help.

2 件のコメント

the cyclist
the cyclist 2021 年 5 月 22 日
Can you upload the data, instead of an image of the data? We can't work with an image.
Phoebe Harris
Phoebe Harris 2021 年 5 月 22 日
Oh sure! Sorry, I didn't consider that.
Hopefully this will work

サインインしてコメントする。

 採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 22 日

0 投票

Hi,
You have overlooked the conversion into date.
Here is the corrected solution code:
clc; clearvars
D=xlsread('datafile.xlsx');
Date1=datenum(D(:,1:6));
errorbar(Date1,D(:,7), D(:,8))
datetick('x','mmm')
Probably, you may need to compute the averages and then error plot. Or go over by monthly.
As is, the plot contains way too many data that is faily difficult to see the process dynamics.
Good luck.

1 件のコメント

Phoebe Harris
Phoebe Harris 2021 年 5 月 22 日
Thank you! I didn't realise that datetick wouldn't function as I wanted

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeErrorbars についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by