User should choose the path for saving variable once

4 views (last 30 days)
Hello all, we are retrieving the result from the GUI developed by us and those results are stored in NOTEPAD with three different filenames, I should provide facility to the user to choose the path once later for saving other two files it has choose same path as default for the next time. i have provided the pseudo code
[fileName,pathName] = uiputfile('Coefficients.h');
file_path = fullfile(pathName,fileName);
fid1 = fopen(file_path, 'wt');
similarly parameters.h etc
i need to save file1 in user defined folder for eg. folder1 once saved while saving file2 it should not ask for the path, it should directly go and save in folder1 or the path should be taken directly to folder1 similarly as goes on
  3 Comments
Stephen23
Stephen23 on 8 Oct 2018
Edited: Stephen23 on 8 Oct 2018
"i am storing in different format like .c and .h"
File extensions do NOT specify the file format. Consider that you take a .txt file and change its file extension to .doc: does this magically change the file format from text file to Word binary file? No, it does not. All it does is change the file extension. The file extension is totally irrelevant to the file format (apart from possibly confusing some Windows OS, but this is not the file format's fault).
Your .h and .c files are most likely text files. If you want to specify how the data are formatted in those files, that you need to give their specifications.

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 8 Oct 2018
Edited: Stephen23 on 8 Oct 2018
Following the description of uiputfile, try something like this:
txt = 'Select Parameter File';
[f1,p1] = uiputfile('*.h',txt);
[f2,p2] = uiputfile('*.h',txt,[p1,filesep]);
[f3,p3] = uiputfile('*.h',txt,[p2,filesep]);
Read the documentation and experiment until you get the desired effect.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!