Matlab:グラフを番号順に画面上に自動で並び替え(マウス作業からの解放)

実現したいこと

  • 複数のグラフを画面上に並べて表示
  • グラフを番号順に並べて表示

上記により,毎回複数のグラフをマウスで移動する手間が省き,作業効率化を図る

Matlabのバージョン

Matlab2022a

ダウンロードURL

gfigure - Google ドライブ

※上記プログラムの利用で生じたトラブルは一切の責任を負いかねます

 

フォルダ構成

上記ダウンロードし展開。
(下記のようなフォルダ構成になっていることを確認)

mファイルソースコード(Main_test.m)

%% 初期化
clc;
close all;
clear;

%% グラフ化
t = 1:100;
figure;plot(sin(t));
figure;plot(sin(t/2));
figure;plot(sin(t/3));
figure;plot(sin(t/4));
figure;plot(sin(t/5));
figure;plot(sin(t/6));
figure;plot(sin(t/7));
figure;plot(sin(t/8));
figure;plot(sin(t/9));
figure;plot(sin(t/10));
 
%% グラフを並べて表示
gfigure 500 400 row 1:10 disp 2
% 【意味】
%『500×400サイズ』のグラフを
%『グラフNo. 1~10の順番』で
%『2番目の拡張ディスプレイ』に並べて表示

実行結果

補足

「row 1:10」の記載がない場合は,順番通りにグラフが並び替えられないため注意

参考ページ(gfigure)

Gridfigure - figures automatically appear aligned - File Exchange - MATLAB Central

併せて確認推奨の過去記事

forfree.hatenablog.jp