How do I save a figure to a different directory with a specific figure name?
Ältere Kommentare anzeigen
I am trying to save a figure with the type and dateTime variables included in the savefile name. My code uses the input variable " type = 'Triangle' " in order to run, and it saves the start time as a dateTime variable. I want the "type" variable to save based on it's input so that the saved figure will include any string assigned to "type." I am also trying to save the figure to a different directory.
I have a code that uses the variable " type = 'Triangle' " when running the code and saves the time I start running the code as f. I want to save that string variable with the date & time as part of the figure name. I'm trying to also save this figure to a different directory that my code is not in.
This is what I have so far but I am getting the following error: H must be an array of handles to valid figures.
type = 'Triangle';
folderName = 'C:\my\directory';
savefig(fullfile(folderName,[datestr(startTime) type]));
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu File Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!