Effacer les filtres
Effacer les filtres

save variable in matlab app designer

26 vues (au cours des 30 derniers jours)
Stetson Spencer
Stetson Spencer le 21 Nov 2018
Modifié(e) : Cris LaPierre le 22 Nov 2018
Hi, I'm trying to save variables when I push a button and put them in a .mat file using the matlab app designer
so far I have it written as:
function SaveMassScaleButtonPushed(app, event)
save('descaling_app.mlapp','app.ms1','app.b1_1','app.m1_1','app.m2_1','app.b2_1')
end
but it gives me an error saying:
Error using save
'app.ms1' is not a valid variable name.
I even had the variable under my properties as:
properties (Access = private)
ms1;
end
and in my start up function as
function startupFcn(app)
app.ms1;
end

Réponses (1)

Cris LaPierre
Cris LaPierre le 22 Nov 2018
My recommendation would be to do the following
function SaveMassScaleButtonPushed(app, event)
ms1 = app.ms1;
b1_1 = app.b1_1;
m1_1 = app.m1_1;
m2_1 = app.m2_1;
b2_1 = app.b2_1;
save('descaling_app.mat','ms1','b1_1','m1_1','m2_1','b2_1')
end

Catégories

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

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by