Filter löschen
Filter löschen

sym matrices get converted to struct

2 Ansichten (letzte 30 Tage)
Vaibhav Raghavan
Vaibhav Raghavan am 19 Aug. 2017
Kommentiert: Vaibhav Raghavan am 23 Aug. 2017
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.

Antworten (2)

Nate
Nate am 21 Aug. 2017
Bearbeitet: Nate am 21 Aug. 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 Kommentare
Nate
Nate am 22 Aug. 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?
Vaibhav Raghavan
Vaibhav Raghavan am 23 Aug. 2017
Yes, that is right. The error occurs when I run the files on any other computer.

Melden Sie sich an, um zu kommentieren.


Steven Lord
Steven Lord am 21 Aug. 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 Kommentare
Walter Roberson
Walter Roberson am 21 Aug. 2017
Please show the output of
which -all sym
on the system that the load fails on.
Vaibhav Raghavan
Vaibhav Raghavan am 22 Aug. 2017
C:\Program Files\MATLAB\R2016a\toolbox\symbolic\symbolic\@sym\sym.m % sym constructor

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by