How do you request an input inside disp?

4 vues (au cours des 30 derniers jours)
João
João le 29 Nov 2014
Commenté : João le 29 Nov 2014
In the program i am developing the user is asked to give a name, through an input, to the file he wants to save. I want to make a disp at the end to show the user a message saying his file was saved just as he asked for in the input. Any help would be greatly appreciated.
Thanks in advance, Best Regards

Réponse acceptée

Mischa Kim
Mischa Kim le 29 Nov 2014
João, you could use inputdlg
prompt = {'Input file name:'};
name = 'File name';
numlines = 1;
answer = inputdlg(prompt,name,numlines)
  1 commentaire
João
João le 29 Nov 2014
How do I apply that to this?
subs =input('What should be the name of the file?','s');
name= subs;
dlmwrite('name.in',distancia_minima,'delimiter','\t');
fprintf(fopen('name.in', 'a'), '\n');
dlmwrite('name.in', ALM,'delimiter','\t', '-append')
fprintf(fopen('name.in', 'a'), '\n');
dlmwrite('name.in', ST,'delimiter','\t', '-append')
disp('your file was saved as %chosen_name ')

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT Files 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!

Translated by