How do i show output from program in the uitextarea?

I have a GUI(has a uitextarea) which takes few inputs and can initiate a program's run.. The GUI has a uitextarea in it.
In the program a certain string will be printed multiple times.
I have tried the following to show the output to the uitextarea
for 1:100
app.OutputTextArea_2.Value = textToDiplay + i;
It is working..But it replaces the earlier values.
May I know how I can keep appending the current text to the already existing text uitextarea.
Thanks.

 採用された回答

frank Eli
frank Eli 2017 年 4 月 16 日

0 投票

Thanks for the answer. But I have solved the problem in a different way.
text =""
for i:100
text = text + i %%something like this..
text = sprintf('%s \n %s',text,textToDiplay);
app.OutputTextArea_2.Value = text;
This things works like a charm.

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2017 年 4 月 13 日

0 投票

frank - try concatenating the existing data with the new
for k = 1:100
app.OutputTextArea_2.Value = [app.OutputTextArea_2.Value "," num2str(textToDiplay + k)];
end
It's unclear what your i and textToDiplay are strings or numbers. I've assumed the latter, so have used num2str to do the conversion.

カテゴリ

ヘルプ センター および File ExchangeGraphics Object Properties についてさらに検索

タグ

質問済み:

2017 年 4 月 13 日

回答済み:

2017 年 4 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by