How to avoid calling multiple figures

3 ビュー (過去 30 日間)
Nom
Nom 2020 年 2 月 25 日
コメント済み: Stephen23 2020 年 2 月 25 日
Hello,
Currently I have a script that goes through multiple CSVs and plots their data. So the number of loops in my script corresponds to the number of files I have it searching through.
i.e
for k = 1 : length(Files)
My problem is, because I'm plotting multiple graphs in different figures for each file. Sometimes, I plot two files on the same figure.
I end up having to hardcode these figures in like this:
f1 = figure;
set(f1,'Visible', 'off');
f2 = figure;
set(f2,'Visible', 'off');
f3 = figure;
set(f3,'Visible', 'off');
f4 = figure;
set(f4,'Visible', 'off');
...
The reason being is that after each loop, sometimes I want it to plot on top of a specific figure from the previous loop. And I can't call on that figure if it isn't already predefined. But I don't want this list going on forever as I realize this isn't the best way of doing this. How can I remove this altogether but still have the functionality of calling on previous figures.
  1 件のコメント
Stephen23
Stephen23 2020 年 2 月 25 日
This is MATLAB, so you should be using indexing with an array of handles:
Using numbered variables is a sign that you are doing something wrong with your code.

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

回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by