How to load an object of class 'sym' in a .mat file

3 次查看(过去 30 天)
Hello,
I have a .mat file which contains objects of class 'sym'. When I try to open this .mat file, MATLAB 2023a gives me the following error:
Warning: Cannot load an object of class 'sym': Its class cannot be found.
Warning: Some variables failed to load, and have been replaced with empty arrays. This might have happened if their classes do not exist on the path.
What should I do in this case to open this .mat file?

回答(1 个)

Steven Lord
Steven Lord 2023-9-6
Do you have Symbolic Math Toolbox installed? If you don't, you won't be able to load sym objects created with the sym or syms functions from that toolbox.
  5 个评论
Walter Roberson
Walter Roberson 2023-9-6
The Symbolic Toolbox computations are performed in a separate process by the Symbolic Engine (symengine). Management of that complete separate process would be needed in order to support compiling the Symbolic Toolbox facilities.
At the moment I do not know of any technical reason why it could not be done, even if it would be a bit clumsy to do it (for example it might mean that every MCR had to include a copy of the engine executable). There are sometimes things that are not especially convenient to do but are not especially "hard" to do.
I have long suspected that there might be licensing reasons involved. Mathworks bought the MuPAD symbolic engine from a company, but that also means that they own the technical rights, so I don't think that it is a limit imposed by an outside company.
However... it could plausibly have to do with the fact that the symbolic engine is a complete programming language, and the input to it is effectively "data" as far as MATLAB is concerned, so if the engine could be compiled, then a sufficiently determined person could create a user interface that allowed a .exe to make general user-specific computations (by routing them through the symbolic engine.) Mathworks is not fond of that possibility, I know.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by