plotting multiple figures with auto naming
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohammed Alhamdan
am 25 Dez. 2022
Kommentiert: Image Analyst
am 27 Dez. 2022
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 25 Dez. 2022
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 Kommentare
Mohammed Alhamdan
am 27 Dez. 2022
Bearbeitet: Mohammed Alhamdan
am 27 Dez. 2022
Image Analyst
am 27 Dez. 2022
Use the 'Interpreter' 'none' option
title(FileName, 'Interpreter', 'none', 'FontSize', 20);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!