How can I name different plots?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by