필터 지우기
필터 지우기

How to send varibles from M file to GUI edit text and can be shown multi-line ?

조회 수: 2 (최근 30일)
I have a GUI named g1,g1 consists of a edit text and a pushbutton;
In the pushbutton_callback(),it invokes function M1(a1,a2);
When invokes M1(a1,a2),some strings,such 'Step1 finished','Step2 finished' and so on,are produced.
I hope these strings can be shown in the Edit Text in turn,such as
Step1 finished
Step2 finished
Step3 finished
Thank you very much!

채택된 답변

Image Analyst
Image Analyst 2013년 1월 22일
I think the max property of an edit text box has to be 2 to get multiline text. Then you need to pass handles to M1, in addition to a1 and a2. Then in M1 you do this
info = sprintf('Step 1 finished.\nStep 2 finished.\nStep 3 finished.');
set(handles,editText1, 'String', info);
You can do that to a static text without changing the max property.
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 1월 22일
Alternately, set the max property to 2 (or larger) and
set(handles.editText1, 'String', {'Step 1 finished.', 'Step 2 finished.', 'Step 3 finished.'})
To do this incrementally,
set(handles.editText1, 'String', {});
for K = 1 : 3
S = get(handles.editText1, 'String');
S{end+1} = sprintf('Step %d finished.', K);
set(handles.editText1, 'String', S);
drawnow();
end
Lisa Wu
Lisa Wu 2013년 1월 22일
Do as you said ,the problem has been solved!
Thank you very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by