Convert 190x1 cell array into scatter plot?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a 190x1 cell array and each cell contains {131x1}. The 190 represents the number of time points or what I want listed as my x-axis. Then each cell contains 131 data points that I want to be my y value for each x-axis value. I can figure out how to get the y values, but unable to figure out how to get the corresponding x-value. I'm sure there is a simple explanation, but i haven't been able to find it through the mathworks website!
x=??
y=cell2mat(data(:))
scatter(x,y)
Thank you so much!
0 件のコメント
回答 (1 件)
Chunru
2021 年 9 月 1 日
% Data: 190x1 cell array and each cell contains {131x1}.
ncells = 20;
npoints = 50;
for i=1:ncells
data{i, 1} = randn(npoints, 1);
end
x=1:npoints;
y=cell2mat(data'); % assume data is ncells x 1
scatter(x,y)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!