How to use variables in Matlab App Designer in all callbacks

I have different callbacks in App Designer for Matlab applications. In my case, a few buttons. I need to use the same variables for this.

I get an error when using a variable that I created in one callback in another ...

+4
source share
1 answer

I think I have your problem.

The easiest way is to create a new property (red button in the upper left corner in the editor) and use it as a variable in the entire code.

Be careful to use app.variablenameto refer to a variable.

, , , , :

set:

properties (Access = private)
     varone %first variable
     vartwo % second variable
     ...
end

Exchange:

varone = app.varone; %(now you can use varone instead of app.varone)

:

app.varone = varone;
+4

Source: https://habr.com/ru/post/1679698/


All Articles