Matlab Appdesigner save('xxx.mat') command won't work

  • Thread starter mastermechanic
  • Start date
  • Tags
    Matlab Work
In summary, the conversation discusses the process of initializing and saving an empty matrix in a startup section. Later, in a button pushed section, the values of an edit box should be recorded and added to the matrix. However, when the code is executed, the values are not being added to the matrix and the load function returns an empty matrix. After further investigation, it is discovered that a reset section between the saving and loading part is causing the issue. Once this mistake is corrected, the problem is solved.
  • #1
mastermechanic
108
15
Homework Statement
It's an Finite Element Method homework to write a code for stresses of the bar and to create a GUI for that.
Relevant Equations
EL = represents Element Matrix but it contains properties of the specific element.
At the start up section I initialize a matrix like:

EL = [ ];
save('EL.mat',"EL");

-------------------------------------------------- This part is okay it creates and saves an empty matrix.

But later, when a button pushed it should record the values of the edit box like:

(This is the section under the app.buttonpushed)

load('EL.mat');
EL = [EL; young_mod length ang];
save('EL.mat', "EL");

---------------------------------------- everything in this buttonpushed section works except this one because when I write load('EL.mat') into command window it returns an empty matrix. I even wrote fprintf('abc'); above load('EL.mat') but it didn't print it.

It made me crazy, it does not read the specific portion of the code and just skips it. I also share the code for you. Please enlighten me.
 

Attachments

  • 1.jpg
    1.jpg
    80.9 KB · Views: 169
Physics news on Phys.org
  • #2
I found the problem it's a foolish mistake :) I had a reset section between the saving and loading part and it was resetting all the variables. Problem solved.
 

1. Why is my "save" command not working in Matlab Appdesigner?

There are a few possible reasons for this issue. First, make sure that you are using the correct syntax for the "save" command. It should be written as "save('filename.mat', 'variable1', 'variable2', ...)" with the file name and all variables enclosed in single quotes. Additionally, check that you have the correct permissions to save files in the specified location. If you are still having trouble, try restarting Matlab and/or your computer.

2. How do I save my Appdesigner project as a .mat file?

To save your Appdesigner project as a .mat file, you can use the "save" command followed by the file name and all variables you want to save. For example, if your file is called "myproject.mat" and you want to save the variables "x" and "y", you would use the command "save('myproject.mat', 'x', 'y')".

3. Why is my saved .mat file not opening in Appdesigner?

If you are trying to open a .mat file in Appdesigner and it is not working, there could be a few potential issues. First, make sure that the file was saved correctly and that all necessary variables were included. Also, check that you are using the correct syntax for the "load" command in Appdesigner. It should be written as "load('filename.mat', 'variable1', 'variable2', ...)" with the file name and all variables enclosed in single quotes.

4. Can I save my Appdesigner project as a different file type?

No, Appdesigner projects can only be saved as .mat files. However, you can export your project as a standalone application or a web app by going to the "Apps" tab and selecting the appropriate option.

5. How do I save my Appdesigner project so that it can be opened on a different computer?

To ensure that your Appdesigner project can be opened on a different computer, you should save it as a .mat file and make sure to include all necessary variables. You may also need to transfer any necessary data files or images to the other computer. Additionally, both computers should have the same version of Matlab and any necessary toolboxes installed for the project to function properly.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
Back
Top