How to save all variables in the matlab base workspace by a button in App?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
채택된 답변
Matt J
2022년 12월 17일
편집: Matt J
2022년 12월 17일
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
Matt J
2022년 12월 17일
You're welcome, but if it did solve your problem, please Accept-click the answer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!