display data in text field MATLAB app designer

91 ビュー (過去 30 日間)
MakM
MakM 2022 年 4 月 10 日
コメント済み: MakM 2022 年 4 月 10 日
How can I display my data into the test field. My data is in the loop as shown in the code. I want to display all data in text field( any other field can be suggested).
function ButtonPushed(app, event)
for i = 1:10
disp(' ')
value1=['Sess (', int2str(i), '/' int2str(i+1) '):']
app.TextArea.Value=value1;
end
end
function TextAreaValueChanged(app, event)
value = app.TextArea.Value;
end

採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 10 日
What is the point of the disp() there?
Inside the loop, you are changing all of the value of the text area, overwriting what was previously there, and you do not have any kind of pause to allow the person to read the text.
If you want to display all of the data, have you considered building a string() array? Possibly even without a loop?
i = (1:10).';
s = "Sess (', " + i + "/" + (i+1) + ")";
app.TextArea.Value = s;
  7 件のコメント
Walter Roberson
Walter Roberson 2022 年 4 月 10 日
app.TextArea.Value = {''};
for i = 1 : 10
s = "Sess (" + i + "/" + (i+1) + ")";
app.TextArea.Value{i} = char(s);
pause(0.05);
end
MakM
MakM 2022 年 4 月 10 日
Thanks Walter, It works :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by