フィルターのクリア

To Save contourf sequentially in loop according to input filename

1 回表示 (過去 30 日間)
Bhowmik.U
Bhowmik.U 2019 年 2 月 5 日
コメント済み: Bhowmik.U 2019 年 2 月 5 日
Hello,
I wish to save contourf sequentially in for loop according to input filename, but it throws error : "Simulink object array must be avector"
My code:
fil=dir('*.h5');
for K=1:numel(fil)
g=fil(K).name; s1=num2str(g(7:11)); %s1 is my file name which changes in each loop
(functions)
im=contourf(x,y,z)
saveas(im,strcat(s1,'.fig'));
saveas(im,strcat(s1,'.png'));
end
I guess I am at lack of understanding the issue...any help shall be welcome !
  1 件のコメント
KSSV
KSSV 2019 年 2 月 5 日
Check how is s1???it should be a string....

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

採用された回答

KSSV
KSSV 2019 年 2 月 5 日
編集済み: KSSV 2019 年 2 月 5 日
Note that im will be matrix. YOu cannot save like that.
Try this:
fil=dir('*.h5');
for K=1:numel(fil)
g=fil(K).name; s1=num2str(g(7:11)); %s1 is my file name which changes in each loop
(functions)
im=contourf(x,y,z)
saveas(gcf,strcat(s1,'.fig'));
saveas(gcf,strcat(s1,'.png'));
end
  5 件のコメント
KSSV
KSSV 2019 年 2 月 5 日
Use hold off when the plotting thing gets over...
Bhowmik.U
Bhowmik.U 2019 年 2 月 5 日
Many thanks Sir! No words to express my gratitude...

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by