Input Dialogue box text not breaking line
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
monkey_matlab
am 16 Nov. 2017
Beantwortet: Star Strider
am 16 Nov. 2017
Hello,
In the code below, I am attempting to break the lines of text in the dialogue box to two lines: line 1: What Text or Word would you like me to write? line 2: [No spaces allowed for first input]
This is what I get
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169694/image.png)
Can you help me break the lines properly? Thanks
% Ask user for input word
Input = inputdlg(['What Text or Word would you like me to write?',...
'\n[No spaces allowed for first input]'],...
'Sample', [1 50]);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 16 Nov. 2017
The sprintf function does this the way you want:
Input = inputdlg(sprintf('%s\n%s', 'What Text or Word would you like me to write?',...
'[No spaces allowed for first input]'),...
'Sample', [1 50]);
(Using inputdlg is definitely the way to go!)
0 Kommentare
Weitere Antworten (0)
Siehe auch
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!