Using variables from other callbacks

15 vues (au cours des 30 derniers jours)
Chinedu Okoye
Chinedu Okoye le 5 Août 2020
Commenté : Chinedu Okoye le 6 Août 2020
Hello,
I'm having issues with calling variables set in my SelectBatteryDataFilesButton callback from my PlotButtonPushed callback. The code is meant to take the data read in and store it in values of X and Y, then plot it once the push button is pressed. Any idea what may be causing the issue? I'm new to app designer and I'm not sure if the set/getappdata is being used correctly.

Réponse acceptée

Mohammad Sami
Mohammad Sami le 6 Août 2020
You dont have to use setappdata, getappdata in app designer.
You can store the values that you want to be available in your app as public or private properties.
You need to add the properties to your app in the GUI before you use them.
These can then be accessed in your function as follows.
function somefunction(app)
app.Propertyname = 12;
end
function someotherfunction(app)
disp(app.Propertyname);
end
  2 commentaires
Chinedu Okoye
Chinedu Okoye le 6 Août 2020
Thank you! This works perfectly.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by