sym matrices get converted to struct
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am working with symbolic expressions. After each computation, i save the resulting symbolic expression as an element in the matrix. Then I save these matrices in a .mat format, and load them later for use in another program. When I load it, the sym matrix gets automatically converted to struct class, and am unable to use this.
The warning reads,' Error occurred while trying to call loadobj on a sym object: Reference to non-existent field 's'. Class 'sym' is an unknown object class or does not have a valid 'loadobj' method. Object 'Uz43s' of this class is converted to struct'.
Here Uz43s was originally a symbolic matrix
The symbolic toolbox is installed properly. I am using MATLAB R2016a (version 9.0.0.341360) with Symbolic toolbox 7.0. I have also tried using higher versions of Matlab - R2017a with Symbolic math toolbox 7.2, and still receive this warning.
0 commentaires
Réponses (2)
Nate
le 21 Août 2017
Modifié(e) : Nate
le 21 Août 2017
Hi Vaibhav,
What functions are you using in order to save and load your symbolic expressions? I am attempting to replicate the issue, so more information about your code would be very helpful. This is my naive attempt:
x = sym('x');
class(x)
y = sym('y');
matrix = [x y]
save( 'test.mat', 'matrix');
clear;
load( 'test.mat' );
This did not produce any errors, and it appears to reload the symbols successfully. Please let me know if you have more information.
3 commentaires
Nate
le 22 Août 2017
Could you clarify the difference between copying the code through the hard drive vs running the code on the other computer? My understanding is that you are copying both the M file and the MAT file, and that the error only occurs when you move the MAT file from one computer to the other and then try to load it. Is that correct?
Steven Lord
le 21 Août 2017
While the MATLAB session in which you created and saved the data has Symbolic Math Toolbox available, I suspect the MATLAB session in which you're trying to load the symbolic matrix does not have Symbolic Math Toolbox installed. Check with the ver function that this product is installed.
3 commentaires
Walter Roberson
le 21 Août 2017
Please show the output of
which -all sym
on the system that the load fails on.
Voir également
Catégories
En savoir plus sur Numbers and Precision 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!