Input Dialogue box text not breaking line

6 次查看(过去 30 天)
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
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]);

采纳的回答

Star Strider
Star Strider 2017-11-16
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 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by