App designer empty vector

1 Ansicht (letzte 30 Tage)
Jonathan Moorman
Jonathan Moorman am 22 Jun. 2020
Bearbeitet: Adam Danz am 22 Jun. 2020
(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

Akzeptierte Antwort

Adam Danz
Adam Danz am 22 Jun. 2020
Bearbeitet: Adam Danz am 22 Jun. 2020
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.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by