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

1 view (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 24 Oct 2011
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);

More Answers (1)

Jan
Jan on 24 Oct 2011
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.

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!