App designer empty vector

5 ビュー (過去 30 日間)
Jonathan Moorman
Jonathan Moorman 2020 年 6 月 22 日
編集済み: Adam Danz 2020 年 6 月 22 日
(All my work is done on app designer) I have a numeric edit field where I input a value of 500. App.EquationsSlopeEditField.Value then stores the value of 500, but I then continuing to recieve an empty vector [ ] for value5. Why is it not taking the value I input? My code is below
function EquationsSlopeEditFieldValueChanged(app, event)
global m
value5 = app.EquationsSlopeEditField.Value;
m = value5;
end

採用された回答

Adam Danz
Adam Danz 2020 年 6 月 22 日
編集済み: Adam Danz 2020 年 6 月 22 日
Don't use global variables.
I'm guessing that you are trying to retrieve the value of m somehwere else in the App but you haven't declared m as global in that section. If you need to share a variable between callback functions, use the public and private properties instead of global variables. I can't emphasize that enough. There's rarely a reason to use global variables and there's a lot of risk that comes with them.

その他の回答 (0 件)

カテゴリ

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