Azzera filtri
Azzera filtri

how to export files to specific folders with GUI?

2 visualizzazioni (ultimi 30 giorni)
Rohan Maharjajn
Rohan Maharjajn il 22 Ago 2017
Commentato: Adam il 23 Ago 2017
i have a GUI which calculates certain data and exports the data to an Excel file and '.jpeg' file of some plots. Now, what I want to do is to export the result to a specific folder like, "Problem 1" when the program is run for the first time ., "Problem 2" for second time and so on.. so i need a counter for the program and also export the results to specific problems.

Risposte (1)

Image Analyst
Image Analyst il 22 Ago 2017
Use the fullfile function to build a complete filename (folder + base file name). Here's an example:
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
  2 Commenti
Rohan Maharjajn
Rohan Maharjajn il 23 Ago 2017
@Image Analyst what i want to do it to save the generated '.jpg' sand '.xlsx' files to a new folder.The folder must be created automatically when the user executes the code . eg: "Problem 1", where '1' is the value of the counter: so for nth execution, the folder name must be, "Problem n"

Accedi per commentare.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by