how to plot cell array in a for loop?

Dear all
I have a 5*12 cell arrey.
I make a for loop to plot 5 rows on top of each other by the following for loop:
figure();
for i=1:5
scatter(a{i,1});
%qqplot(biascorrected_P_RCM{i,1},DailyRes_PT_nonZero{1,1}(:,1));
hold on
end
But I want to have seperate plots ofr each of this 12 column. of course I can write one by one seperately but I want to have nested for loops
for i=1:12
for j=1:5
end
end
how can I have 12 plots in which each 5 rows have been plotd on top of each other?

回答 (1 件)

KSSV
KSSV 2020 年 6 月 7 日

0 投票

figure
hold on
for i=1:12
for j=1:5
scatter(a{j,i})
end
end

8 件のコメント

frankovaT
frankovaT 2020 年 6 月 7 日
but now all of them are on top of each other, while I wanted seperate 12 plots having each on these 5 rows in.
KSSV
KSSV 2020 年 6 月 7 日
for i=1:12
figure(i)
hold on
for j=1:5
scatter(a{j,i})
end
end
frankovaT
frankovaT 2020 年 6 月 7 日
first: thanks for trying to help me.
second: though it seemed very legit but it didn't work.
I got the error:
Error using scatter (line 46) Not enough input arguments, when using scatter.
I also tried with plot and i got it exactly as I had it before. all 60 on top of each other.
KSSV
KSSV 2020 年 6 月 7 日
How did you plot th previous figure with out error? Attach your data.
frankovaT
frankovaT 2020 年 6 月 7 日
attached please find my data.
Thanks
KSSV
KSSV 2020 年 6 月 7 日
load("a.mat") ;
[m,n] = size(a) ;
for i=1:n
figure(i)
hold on
for j=1:m
plot(a{j,i})
end
end
The above gave me 12 plots.
frankovaT
frankovaT 2020 年 6 月 7 日
For me all of them are on top of each other!
do you think it can have anything to do with matlab version?
Mine is 2020a (I update constantly)
frankovaT
frankovaT 2020 年 6 月 7 日
Can you please show me your plots?

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

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2020 年 6 月 7 日

編集済み:

2020 年 6 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by