Take input in Matlab App Designer

I want user to give input in commas i.e -> 2,-6,-3,10,6,-6,10 and then work on it.So please help me with this.Im using Matlab App Designer Online.

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 10 月 10 日

1 投票

You can use uieditfield(): https://www.mathworks.com/help/matlab/ref/uieditfield.html in the app designer. Use the text version of UIEditfield to get the input in a vector format.

6 件のコメント

Tejas Mahajan
Tejas Mahajan 2020 年 10 月 10 日
i used but its taking it a only one value on seperate.Can you helpme with small code for it please.
Ameer Hamza
Ameer Hamza 2020 年 10 月 11 日
You need to use text-based UI editfield. For example, run the following lines
f = uifigure();
ef = uieditfield(f, 'text');
It will open a figure with edit field. Enter following in edit field
[1,2,3]
Then run following lines of code
>> str = ef.Value;
>> str2num(str)
ans =
1 2 3
Tejas Mahajan
Tejas Mahajan 2020 年 10 月 12 日
Sorry Sir, but im still not getting. Like can please send me a small app please.I want to print the value without using uifigure, i want to use only the edit field for input and another edit field for the output. Please take some time out and help me Sir.
Ameer Hamza
Ameer Hamza 2020 年 10 月 12 日
I attached a demo app on this answer: https://www.mathworks.com/matlabcentral/answers/609146-how-to-take-inputs-in-numeric-edit-field#answer_509636. It shows how to take input from the edit field and then output on another editfield.
Tejas Mahajan
Tejas Mahajan 2020 年 10 月 12 日
But sir it dossent take multiple negative values, i want user to give input as [1,-3,-5,7] and below that the output must be printed as 1 -3 -5 7 . I hope you getting my problem.
Ameer Hamza
Ameer Hamza 2020 年 10 月 12 日
str2num is able to handle this case too
A = '[1,-3,-5,7]';
B = str2num(A);
Result
>> B
B =
1 -3 -5 7

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

カテゴリ

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

タグ

質問済み:

2020 年 10 月 10 日

コメント済み:

2020 年 10 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by