フィルターのクリア

exportgraphics dynamic file name

9 ビュー (過去 30 日間)
Pelajar UM
Pelajar UM 2022 年 3 月 22 日
コメント済み: Ive J 2022 年 3 月 22 日
What's the correct syntax if you want to name the files dynamically when using exportgraphics?
I have a cell array A with 16 titles in each columns that are assigned to the colorbar string. I want to use the same titles to name the files.
for k = 1:16
%rest of the code
c = colorbar;
c.Label.String = string (A (:,k));
exportgraphics(gcf, string (A(:,k)) '.png' ,'Resolution',DPI) %this doesn't work
end

採用された回答

Ive J
Ive J 2022 年 3 月 22 日
% A = {'name1', ...}
for k = 1:16
%rest of the code
c = colorbar;
c.Label.String = A{k};
exportgraphics(gcf, string(A{k}) + ".png" ,'Resolution',DPI) %this doesn't work
end
You could also use strcat, join or similar functions.
  10 件のコメント
Pelajar UM
Pelajar UM 2022 年 3 月 22 日
Exactly what I was looking for. Thanks a lot!
Ive J
Ive J 2022 年 3 月 22 日
Glad it works
cheers!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by