App designer empty vector

5 visualizaciones (últimos 30 días)
Jonathan Moorman
Jonathan Moorman el 22 de Jun. de 2020
Editada: Adam Danz el 22 de Jun. de 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

Respuesta aceptada

Adam Danz
Adam Danz el 22 de Jun. de 2020
Editada: Adam Danz el 22 de Jun. de 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.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by