How do you request an input inside disp?

조회 수: 4 (최근 30일)
João
João 2014년 11월 29일
댓글: João 2014년 11월 29일
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

채택된 답변

Mischa Kim
Mischa Kim 2014년 11월 29일
João, you could use inputdlg
prompt = {'Input file name:'};
name = 'File name';
numlines = 1;
answer = inputdlg(prompt,name,numlines)
  댓글 수: 1
João
João 2014년 11월 29일
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 ')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by