Hi, I have got the following lines of code:
aa = dataraw_GSR_RELAXING.CREATION_TIME(1:283)
bb = dataraw_GSR_RELAXING.VALUE(1:283)
plot(aa,bb)
aa corresponds to a column with times as is shown in the screenshot below.
bb is a column with the same size but instead of times it has numerical values.
When I try to plot the values against the time, I get a message saying 'Invalid data argument'.
Could someone please teach me how to plot this? I looked into examples from the forum and tried to reproduce but without success.
Thanks in advance for your help.

 採用された回答

Walter Roberson
Walter Roberson 2023 年 3 月 28 日

0 投票

aa = cell2mat(dataraw_GSR_RELAXING.CREATION_TIME(1:283));
bb = cell2mat(dataraw_GSR_RELAXING.VALUE(1:283));
plot(aa, bb)

8 件のコメント

Ana Campos
Ana Campos 2023 年 3 月 29 日
Hi Walter,
Thanks for your time.
Unfortunately it did not work. I get the following message:
"Brace indexing is not supported for variables of this type.
Error in cell2mat (line 42)
cellclass = class(c{1});
Error in PhD_Experiment_2_GSR_wip (line 325)
bb = cell2mat(dataraw_GSR_RELAXING.VALUE(1:283));"
Walter Roberson
Walter Roberson 2023 年 3 月 29 日
aa = cell2mat(dataraw_GSR_RELAXING.CREATION_TIME(1:283));
bb = dataraw_GSR_RELAXING.VALUE(1:283);
plot(aa, bb)
Ana Campos
Ana Campos 2023 年 3 月 29 日
Hi Walter,
Unfortunately that does not do the trick either.
"Error using plot
Invalid first data argument.
Error in PhD_Experiment_2_GSR_wip (line 328)
plot(aa, bb)"
If relevant - this is what my table looks like (from where I am extracting the data)
aa = cell2mat(dataraw_GSR_RELAXING.CREATION_TIME(1:283));
bb = dataraw_GSR_RELAXING.VALUE(1:283);
plot(aa, bb)
Ana Campos
Ana Campos 2023 年 3 月 29 日
It plots just the 'VALUE'. When I try to plot VALUE against CREATION_TIME it does not work.
Walter Roberson
Walter Roberson 2023 年 3 月 29 日
aa = duration(dataraw_GSR_RELAXING.CREATION_TIME(1:283));
bb = dataraw_GSR_RELAXING.VALUE(1:283);
plot(aa, bb)
Ana Campos
Ana Campos 2023 年 3 月 29 日
Thanks for your help!
Peter Perkins
Peter Perkins 2023 年 4 月 5 日
Ana, Walter seems to have gotten you back in business, but I will just add that you may have wanted to read your data using readtimetable, not readtable. That would have put you one step closer to that plot.
Ana Campos
Ana Campos 2023 年 4 月 5 日
Hi Peter,
Another tip to add to the list then! Thanks for taking the time to comment too. I’ll keep that in mind for when I need it next. Cheers!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by