plotting cells from arrays
古いコメントを表示
for k2 = 1:22
data2 = mean(cellfun(@(x) x(k2,4), thething))
plot(data2,'-')
end
this is my codes. thething is my arrays contain cells. After I run the scripts, the plot just show nothing on it. Please tell me what's wrong with my code?
8 件のコメント
KSSV
2018 年 6 月 27 日
what is size and class of data2?
Kuang-Yu WANG
2018 年 6 月 27 日
Stephen23
2018 年 6 月 27 日
Probably plotting inside the loop is not useful. Put the values in an array, and then plot that after the loop.
Kuang-Yu WANG
2018 年 6 月 27 日
@Kuang-Yu WANG: your comment states that the size of the data that you are plotting is 1x1: this will not be visible unless you change the marker type. In any case, even if you specify the marker you will not get a line unless you do what I recommended earlier: collect the data into one matrix and then plot it after the loop. The plot help has plenty of examples (in fact all of the examples) showing how to plot matrices, so start by looking at that.
Ankita Bansal
2018 年 6 月 28 日
Hi, can you share " thething" ?
Kuang-Yu WANG
2018 年 6 月 28 日
Stephen23
2018 年 6 月 28 日
@Kuang-Yu WANG: please upload your data in a .mat file by clicking the paperclip button.
回答 (1 件)
KSSV
2018 年 6 月 27 日
figure
hold on
for k2 = 1:22
data2 = mean(cellfun(@(x) x(k2,4), thething))
plot(data2,'-')
end
4 件のコメント
Kuang-Yu WANG
2018 年 6 月 27 日
KSSV
2018 年 6 月 27 日
What is class and size of data2?
Kuang-Yu WANG
2018 年 6 月 28 日
Kuang-Yu WANG
2018 年 6 月 28 日
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!