MATLAB Answers

How to input numeric array into Edit Filed when push button using App Designer?

14 ビュー (過去 30 日間)
jiwon ham
jiwon ham 2019 年 11 月 23 日
コメント済み: jiwon ham 2019 年 11 月 30 日
I want to put array into Edit Field when I push button in regular order.
It mean, I put value button1=1, and button 2 value is 2, button3 value is 3....
and when I press button 1,3,2 in regular order,
I want to output value like [1 3 2] in Edit Field.
Here is my code,
function Button_9ValueChanged(app, event)
if app.Button_9.Value == 1;
app.EditField.Value = num2str(1)
else app.Button_9.Value == 0;
app.EditField.Value = num2str(0) %I use statebutton
end
I make my code like that button 9 to 15, the value is 1to 7
If there anyone know how to solve this problem, please help me :(

  4 件のコメント

表示 1 件の古いコメント
jiwon ham
jiwon ham 2019 年 11 月 25 日
Yes. All buttons are state button
Ajay Kumar
Ajay Kumar 2019 年 11 月 26 日
So, if the state is on, you want to display the number in editfield? and if state is off, you want to display nothing? or 0?
jiwon ham
jiwon ham 2019 年 11 月 30 日
I want to display nothing on my editfield. Sorry for late answer:(

サインイン to comment.

採用された回答

Jyotsna Talluri
Jyotsna Talluri 2019 年 11 月 26 日
Hi,
In state buttons we have 'Text' field.Fill the text field with the values you want to put into the array (1,2..).In the callback function of each state button if state button is active append the text to the edit fied value
function Button_3ValueChanged(app, event)
value = app.Button_3.Text;
if app.Button_3.Value==1
app.EditField.Value= [app.EditField.Value value];
end
end
I have attached a screenshot to display how it works.

  1 件のコメント

jiwon ham
jiwon ham 2019 年 11 月 30 日
It worked! Thank you for your help.
Have a good day:)

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。


Translated by