フィルターのクリア

only saving last image

2 ビュー (過去 30 日間)
HYZ
HYZ 2022 年 9 月 1 日
編集済み: HYZ 2022 年 9 月 3 日
hi, this is my code. Figures are plotted correctly but only the last " i " image was saved for all iterations. Please advise which part was wrong. thanks.
for m = 1: size (OSI,1)
if OSI (m) > 0.5
for i = 1: size (trial_trace,3)
p(i) = figure (i);
for j = 1:5
subplot(5,1,j)
for k = 1:8
if j ~= 5
plot (trial_stimstarts_reset(j,k):trial_stimends_mod_reset(j,k), trial_trace{j,k,i})
ylabel(sprintf('Trial %d', j))
if j == 1
title (sprintf('ROI %d: OSI %0.2f DSI %0.2f', m, OSI(m), DSI (m)))
end
elseif j == 5
plot (trial_stimstarts_reset(1,k):trial_stimends_mod_reset(1,k), trial_trace_avg{1,k,i})
ylabel('Average')
end
hold on
end
end
end
cd(path_stim_all{itr})
saveas (p(i),strcat('trace_','ROI', '_', num2str(m), '_', 'OSI', '_', num2str (OSI(m)), 'DSI', '_', num2str (DSI(m)), '.jpeg'));
end
end

採用された回答

Image Analyst
Image Analyst 2022 年 9 月 2 日
saveas() needs to be inside the loop over i. Right now it's between the end of the i loop but before the end of the m loop.
  10 件のコメント
HYZ
HYZ 2022 年 9 月 2 日
I reattached the .mat.
HYZ
HYZ 2022 年 9 月 3 日
編集済み: HYZ 2022 年 9 月 3 日
path_stim_all{itr} is just for where to save. sorry forgot to mention.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by