sym matrices get converted to struct
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Nate
2017-8-21
编辑:Nate
2017-8-21
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 个评论
Nate
2017-8-22
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
2017-8-21
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 个评论
Walter Roberson
2017-8-21
Please show the output of
which -all sym
on the system that the load fails on.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!