How do I input multiple values into Edit Field in matlab app designer ?

Hello
im trying to create an app (in matlab app designer) that enables inputting a number which defines a vector length, and afterwards to be able to input every value in the vector in a new numeric field.
The problem is that number of values is defined "online" while the app is running, so i cant define all the numeric fields before the running ... I will be glad to get a solution for that
Thanks

回答 (1 件)

Matt J
Matt J 2023 年 8 月 11 日
編集済み: Matt J 2023 年 8 月 11 日
You can put any text into an edit field, whether it be a scalar, a vector, or something else entirely.
app.EditField=mat2str([1,2,3])
app = struct with fields:
EditField: '[1 2 3]'

4 件のコメント

VBBV
VBBV 2023 年 8 月 12 日
app.EditField.Value=mat2str([1,2,3])
As @Matt J showed, you can enter any input values when the app is running and after the user enables the input by a finite scalar value or as a vector.
norman zawahri
norman zawahri 2023 年 8 月 12 日
Thank you for your response, but is it possible to add each one of the values in the vector as a separate numeric field in the main interface, while the number of the numeric fields in the interface isnt known already?
i just want to have a numeric field that i input the amount of the variables (n) in the main interface, and according to that i get n empty numeric fields ... i hope i explained it better :)
Matt J
Matt J 2023 年 8 月 12 日
編集済み: Matt J 2023 年 8 月 12 日
i just want to have a numeric field that i input the amount of the variables (n) in the main interface, and according to that i get n empty numeric fields
You can't use app designer for that You would have to programatically layout the GUI, which will be a lot more painstaking work.
It sees inadvisable, in any case. Rather than creating n different fields, you should cherish Matlab's ability to understand vector input, and take advantage of that capability wherever you can.
norman zawahri
norman zawahri 2023 年 8 月 12 日
Thank you again

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

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2023a

質問済み:

2023 年 8 月 11 日

コメント済み:

2023 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by