I am getting this warning after applying my string to a text box.'Single line Edit Controls can not have multi-line text'

1 次查看(过去 30 天)
This is the part of my code after which its throwing me the warning
_ set(cal_glbl_data.out_msg_solver,'String',char({'Computation in progress ... ' cal_glbl_data.cals{1} num2str(print_x)}))_
Here cal_glbl_data.out_msg_solver contains the handle of the text box while cal_glbl_data.cals{1} contains another string and print_x contains a number.
As soon as matlab executes above line the text box disappears and the following warning is displayed on the command window
Pleae help me out in this condition.

采纳的回答

Image Analyst
Image Analyst 2011-10-24
Make sure the 'Max' property of your edit text box is set to 2 so that you can have multi-line text strings in it. If it's 1 you can have only single line.
set(cal_glbl_data.out_msg_solver, 'Max', 2);

更多回答(1 个)

Jan
Jan 2011-10-24
The string you want to insert in the textbox is:
Str = char({'Computation in progress ... ',
cal_glbl_data.cals{1}, ...
num2str(print_x)})
The char command converts the {1 x 3} cell string into a [3 x N] CHAR matrix. But the peroperty must be a string, which is a [1 x N] CHAR vector.
I guess you want:
Str = ['Computation in progress ... ',
cal_glbl_data.cals{1}, ...
num2str(print_x)];
You can use the debugger to find such problems by your own: Set a breakpoint in the corresponding line and check the results in the command window.

类别

Help CenterFile Exchange 中查找有关 Scope Variables and Generate Names 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by