App designer empty vector

5 views (last 30 days)
Jonathan Moorman
Jonathan Moorman on 22 Jun 2020
Edited: Adam Danz on 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

Accepted Answer

Adam Danz
Adam Danz on 22 Jun 2020
Edited: Adam Danz on 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.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!