How to save all variables in the matlab base workspace by a button in App?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I use "assignin" to write the variable created in App designer to the workspace, but I also manually type the code or formula in the command window to calculate, and thus create more variables.
I want to save all these variables in the workspace. I can use "save('C:\test.mat')" in the command window with no problem. I also have a save button in the app, which is supposed to do the same thing (save all variables in the matlab workspace).
With save('C:\test.mat') by the button, app designer will save all variables in both matlab workspace and the app desinger workspace, and then get a warning that Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
My question is how to save all these variables only in the matlab workspace?
Edit: matlab workspace means the base one
0 commentaires
Réponse acceptée
Matt J
le 17 Déc 2022
Modifié(e) : Matt J
le 17 Déc 2022
It is not clear what you mean by, "the Matlab workspace". I will assume you mean the base workspace, i.e., the workspace of the command window. In your save button's callback, you would need,
str= "save('C:\test.mat')";
evalin('base',str)
2 commentaires
Matt J
le 17 Déc 2022
You're welcome, but if it did solve your problem, please Accept-click the answer.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Entering Commands 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!