User should choose the path for saving variable once

1 visualización (últimos 30 días)
sandeep singh
sandeep singh el 8 de Oct. de 2018
Comentada: sandeep singh el 9 de Oct. de 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 comentarios
sandeep singh
sandeep singh el 8 de Oct. de 2018
i am storing in different format like .c and .h
Stephen23
Stephen23 el 8 de Oct. de 2018
Editada: Stephen23 el 8 de Oct. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Stephen23
Stephen23 el 8 de Oct. de 2018
Editada: Stephen23 el 8 de Oct. de 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.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by