Display arrays in app designer edit text

15 ビュー (過去 30 日間)
Sikder Meaghi
Sikder Meaghi 2021 年 2 月 17 日
回答済み: Deepak 2024 年 9 月 3 日
A=[ y1 y2 y3 y4 y5];
U= A>maxVal;
L= A<minVal;
x= find(U);
y= find(L);
R= union(outU,outL);
My code is running properly upto this but I can't find a way to display this in appdesigner edit text. I need the result of R, which may be a row matrix with multiple columns, be displayed in an edit text box of matlab app designer. Thank you in Advance for your help.
  1 件のコメント
Mario Malic
Mario Malic 2021 年 2 月 17 日
Use TextArea component for it to reliably display the array. See num2str to convert your array to char array to display it in the TextArea.

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

回答 (1 件)

Deepak
Deepak 2024 年 9 月 3 日
I understand that you have written a MATLAB code to generate a row matrix with multiple columns, and you want to display the matrix in an Edit Field (Text) in the App Designer.
To achieve this, you should first convert the matrix into string representation with the help of “mat2str()function. This is useful for displaying the contents of a matrix in a text field. Then, you can assign the result to “app.EditField.Value to display it in Edit Field(Text). Additionally, you can place the entire code in thestartupFcn()” callback of your app, so that it executes on startup of the application.
Here is the MATLAB code that addresses the task:
% Convert R to a string
R_str = mat2str(R);
% Set the value of the edit text field
app.EditField.Value = R_str;
Attaching the documentation of “mat2str” for reference:
I believe this will fix the issue.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by