App designer empty vector

조회 수: 1 (최근 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 CenterFile Exchange에서 Develop 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