Duplicating "Save Workspace" button with command.
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dale Huffman
il 4 Giu 2020
Commentato: Ameer Hamza
il 6 Giu 2020
I'm trying to duplicate pushing the "Save Workspace" button, setting the "Files of Type" to ".m" file. The result of this is a ".m" file that looks like:
A1 = 2.5;
B1 = 27.31;
X4 = [0.4719; 0.0013; 2.5; 3.162-5; 9.900; 2.5];
In addition a .mat file for the items that couldn't be coverted to clean ascii I guess, but I don't care about the .mat file, I only care about the .m file.
I have tried all options that seem to be documentd in the "save" function like "save('outcmd.m','-ascii','-double')", including "-ascii", "-tabs", none of them produce the same output. I'm guessing "save" maybe isn't the correct function, or there is a hidden argument.
Can you provide the correct command to duplicate the output above?
0 Commenti
Risposta accettata
Ameer Hamza
il 5 Giu 2020
This the function you want: https://www.mathworks.com/help/matlab/ref/matlab.io.savevariablestoscript.html
matlab.io.saveVariablesToScript('filename.m')
4 Commenti
Ameer Hamza
il 6 Giu 2020
What about loadmat from scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.loadmat.html
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Workspace Variables and MAT Files in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!