How to give an option to user of where to save the generated file
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
raghavendra kandukuri
le 24 Août 2018
Réponse apportée : Image Analyst
le 25 Août 2018
How to give an option to user of where to save the generated file, right now it is storing those files where .m files are there, but i want to give user the flexibility of storing those files where ever they want, i have tried the following code and its not working. It is opening the that browse location window but the output is not storing there, it still stores at, where .m files are.
downloadsFolder = strcat('C:\Users\',getenv('username'),'\Downloads');
SaveDir = uigetdir(downloadsFolder,'Select folder to save newly created Excel files to...');
while SaveDir == 0
SaveDir = uigetdir(downloadsFolder,'Select folder to save newly created Excel files to...');
dlmwrite('PRM.txt',m1,'delimiter','\t','-append','newline','pc');
dlmwrite('PRM.txt',ThrTbl,'delimiter','\t','-append','newline','pc');
end
0 commentaires
Réponse acceptée
Stephen23
le 24 Août 2018
Modifié(e) : Stephen23
le 24 Août 2018
dlmwrite(fullfile(SaveDir,'PRM.txt') ,...)
6 commentaires
raghavendra kandukuri
le 24 Août 2018
Modifié(e) : Walter Roberson
le 24 Août 2018
Stephen23
le 25 Août 2018
@raghavendra kandukuri: remember to accept the answer that helped you to resolve your original question!
Plus de réponses (1)
Image Analyst
le 25 Août 2018
Try this:
% 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, 'PRM.txt');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
dlmwrite(fullFileName, .......etc.
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!