フィルターのクリア

How can I name different plots?

1 回表示 (過去 30 日間)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 10 月 25 日
コメント済み: MAHMOUD ALZIOUD 2017 年 10 月 27 日
hello Everyone ,
I draw a lot of monthly data plot by a for loop from 1 to K, and each plot depends on the inputs from every month. I want to make a statement in each plot saying (This Month is 1, OR 2 or etc.). how can I please do that? the month variable in my code is called month and it is from 1 to 12.
  2 件のコメント
KSSV
KSSV 2017 年 10 月 26 日
How many plot you have K number of plots?
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 10 月 26 日
I have 12 plots, each plot represents one month in the year, so K is 12 please

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

採用された回答

KSSV
KSSV 2017 年 10 月 27 日
months = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','sep','oct','Nov','Dec'} ;
for i = 1:12
data = rand(10,1) ;
h(i) = figure ;
plot(data) ;
title(months{i}) ;
end
  2 件のコメント
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 10 月 27 日
thank you very much for the answer, i will try it tomorrow and i will let you know what happened. best regards
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 11 月 8 日
編集済み: MAHMOUD ALZIOUD 2017 年 11 月 8 日
Dear Mr KSSV, I have two cards, one for january and one for july, the months then must be 1 and 7. I wrote this code in order to plot a histogram for each card with the suitable title, how can I please index the variable TandLoad so I can have two histograms with each card data in each histogram? Note that K here is 2 because I have 2 cards just. when i run this code it gives me the histogram for july twice !! where is january one?
for K = 1 : length(directory)
filename = directory(K).name;
xtn1=Class9_data(:,15)*0.1*3.28084; %distance between A & B in ft
Tand1= Class9_data(xtn1(:,1)>3.28 & xtn1(:,1)<8 , :);
xtn2=Class9_data(:,17)*0.1*3.28084; %distance between B & C in ft
Tand2 = Class9_data(xtn2(:,1)>3.28 & xtn2(:,1)<8 , :);
xtn3=Class9_data(:,19)*0.1*3.28084; %distance between C & D in ft
Tand3 = Class9_data(xtn3(:,1)>3.28 & xtn3(:,1)<8 , :);
xtn4=Class9_data(:,21)*0.1*3.28084; %distance between D & E in ft
Tand4 = Class9_data(xtn4(:,1)>3.28 & xtn4(:,1)<8 , :);
TandemData=[Tand1;Tand2;Tand3;Tand4];
TandemLoad=[100*(Tand1(:,14)+Tand1(:,16));100*(Tand2(:,16)+Tand2(:,18));100*(Tand3(:,18)+Tand3(:,20));100*(Tand4(:,20)+Tand4(:,22))]; %it is multiplied by 100 because the units of weight are 100 kgm
figure
histogram(TandemLoad)
months = unique(Ans_7 (K)) ;
xlabel('Weight in Kg')
ylabel('Counts')
title(['ALS for C9 Tandem For Month ',num2str(months)])
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by