How to plot data from cells?

7 ビュー (過去 30 日間)
Khan Muhammad Adeel Khan
Khan Muhammad Adeel Khan 2022 年 11 月 11 日
回答済み: Voss 2022 年 11 月 11 日
I have data for four different conditions saved in a cell format. Someone please guide me how to plot the data? I have tried the plotSpread function but it is generating following errors:
Unrecognized function or variable 'repeatEntries'.
Error in plotSpread (line 192)
distributionIdx = repeatEntries((1:nData)',nn);
The data file iis attached. Many thanks !

採用された回答

Benjamin Kraus
Benjamin Kraus 2022 年 11 月 11 日
When you say "plot the data", can you provide a little more information about kind of picture you are trying to create? What data do you want on the x-axis? What data on the y-axis? What does your data represent? "plot the data" is pretty generic, so more information would help others answer your question.
From your question it looks like you are trying to use the plotSpread function from the MATLAB File Exchange, but you are missing one of the functions that is included along with that File Exchange entry (the file called repeatEntries.m). If that is the problem you are having, make sure you downloaded all the files in the File Exchange entry and have them available on your MATLAB path.

その他の回答 (1 件)

Voss
Voss 2022 年 11 月 11 日
Here's one way:
load('data_conditions.mat')
data_oROI
data_oROI = 1×4 cell array
{43×1×1×31 double} {43×1×1×31 double} {43×1×1×31 double} {43×1×1×31 double}
for ii = 1:numel(data_oROI)
subplot(2,2,ii)
plot(squeeze(data_oROI{ii}))
end

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by