Save histogram graphs during for loop operation

조회 수: 20 (최근 30일)
Turbulence Analysis
Turbulence Analysis 2022년 2월 7일
댓글: Mia 2023년 10월 19일
Hi,
I got my data stored in the form of 100 x 192, I am generating one histrogram plot per 8 columns of data. This means, finally 24 histogram plots. May I know, how to save one histogram plot for every 8 iteration!!!
for i = 1:1:192
BB = Data (:,i);
histogram(BB);
hold on
end

채택된 답변

Ankit
Ankit 2022년 2월 7일
n = 1;
for i = 8:8:192
Data = rand(100,192);
BB = Data (:,n:i); n = i;
f=figure;
histogram(BB);
saveas(f, ['histogram' num2str(i/8) '.png'])
hold on
end
exportgraphics in case you are using above 2020
% Requires R2020a or later
exportgraphics(f,['histogram' num2str(i/8) '.png'],'Resolution',300)
  댓글 수: 4
Turbulence Analysis
Turbulence Analysis 2022년 2월 7일
Thanks a lot.. This is perfect !!!
Mia
Mia 2023년 10월 19일
Thank you!!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by