User should choose the path for saving variable once

1 Ansicht (letzte 30 Tage)
sandeep singh
sandeep singh am 8 Okt. 2018
Kommentiert: sandeep singh am 9 Okt. 2018
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 Kommentare
sandeep singh
sandeep singh am 8 Okt. 2018
i am storing in different format like .c and .h
Stephen23
Stephen23 am 8 Okt. 2018
Bearbeitet: Stephen23 am 8 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Stephen23
Stephen23 am 8 Okt. 2018
Bearbeitet: Stephen23 am 8 Okt. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Environment and Settings 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!

Translated by