plotting multiple figures with auto naming
7 ビュー (過去 30 日間)
古いコメントを表示
Mohammed Alhamdan
2022 年 12 月 25 日
コメント済み: Image Analyst
2022 年 12 月 27 日
I have a folder with multiple txt files that I want to print into separate figures. How can I load, plot, and print each figure with the same file name without naming them manually each time?
0 件のコメント
採用された回答
Image Analyst
2022 年 12 月 25 日
Is this what you want to do?
% Get a list of all txt files in the current folder.
fileList = dir('*.txt')
numFiles = numel(fileList)
% Create a figure for each file.
for k = 1 : numFiles
% Build the string you want to display in the titlebar of the figure.
thisFileName = sprintf('File #%d of %d = %s', k, numFiles, fileList(k).name)
% Create a figure and make the title bar have that string.
hFig(k) = figure('Name', thisFileName, 'NumberTitle','off');
% Now do stuff with thisFileName, like plot it or whatever
end
4 件のコメント
Image Analyst
2022 年 12 月 27 日
Use the 'Interpreter' 'none' option
title(FileName, 'Interpreter', 'none', 'FontSize', 20);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!