フィルターのクリア

How to save the input of an edit text box on GUI?

12 ビュー (過去 30 日間)
Adam Luckman
Adam Luckman 2018 年 12 月 9 日
回答済み: Cris LaPierre 2018 年 12 月 9 日
I want to have the user input their first value into the edit box, click the save button (saving the input to an array) and then for them to be able to reinput another value in the same box and then that value also being saved in to the array. I want them to be able to do this as many times as they want until they click the calculate button of which a static box will show them the sum of this array.
I cannot seem to figure out how to set up the array inside the callback, as when i try i usually get: 'Array indices must be positive integers or logical values.' Error.

採用された回答

Cris LaPierre
Cris LaPierre 2018 年 12 月 9 日
Create a property for storing the values. You don't have to assign it a value, just name it. I named mine "nums"
properties (Access = private)
Nums; % Description
end
Add a callback to your edit field for when the value changes. Create your array by appending the current number to your property variable. This adds it to the top, but you can code this however you want.
% Value changed function: EditField5
function EditField5ValueChanged(app, event)
value = app.EditField5.Value;
app.Nums = [value; app.Nums];
end

その他の回答 (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