issues with syms function

Whenever I use the syms (symbolic function) code I keep getting errors, even on simple codes that I am sure they are correct.
For example this simple code
syms a [1 4]
a
The output
Error in syms (line 227)
defined = sym(zeros(1, length(args)));
Error in quiz (line 1)
syms a [1 4]

9 Commenti

Ameer Hamza
Ameer Hamza il 8 Ott 2020
Modificato: Ameer Hamza il 8 Ott 2020
What is the complete error message? Can you show the output of
which sym -all
The output I've shown above is the whole error message
This is the output to which sym -all
Applications/MATLAB_R2020a.app/toolbox/symbolic/symbolic/@sym/sym.m % sym constructor
There would have been more to the error message, such as an error that args was not defined, or that sym was being called as a function by is a script, or something.
Have you tried changing the file sym.m installed by MATLAB? To check, run the following in the command window
edit sym.m
it will open a file. See if the first line of the file is
classdef sym < handle
Reem Alblooshi
Reem Alblooshi il 10 Ott 2020
yes it seems that I do have a file named sym.m, but classdef sym < handle is not the first line on the file, it doesnt even exist in the file.
GAGANDEEP KAUR
GAGANDEEP KAUR il 27 Ott 2020
I also have some problem with using syms a b c d e , my program keeps on running and when I am pausing it, it is opening sym.m file.
Although first line of the file is
classdef sym< handle
If anyone can help?
restoredefaultpath
rehash toolboxcache
syms x
and see if that works.
I suspect you have a third-party function that is interfering with operation the Mathworks sym.m
GAGANDEEP KAUR
GAGANDEEP KAUR il 27 Ott 2020
I have tried as you adviced but still it is keep on running. If possible may you please have a look at attcahed files

Accedi per commentare.

 Risposta accettata

Ameer Hamza
Ameer Hamza il 10 Ott 2020

0 voti

Most likely scenario is that you somehow overwrote the sym.m file. The only way to fix it is to delete the current installation and reinstall MATLAB.

2 Commenti

Reem Alblooshi
Reem Alblooshi il 11 Ott 2020
yes I did that and the programs is working now, thank you for your assistance.
Ameer Hamza
Ameer Hamza il 11 Ott 2020
I am glad to be of help!

Accedi per commentare.

Più risposte (1)

madhan ravi
madhan ravi il 8 Ott 2020

0 voti

You have a custom file named sym.m , remove it from the path or rename it.

1 Commento

Reem Alblooshi
Reem Alblooshi il 10 Ott 2020
I tried deleting the file but I keep getting this messsage
Warning: File 'sym.m' not found.
> In quiz (line 2)
although the file does exist.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by