Getting "Execution of script roots as a function is not supported:" error

117 views (last 30 days)
Hi,
I am trying to find the roots of an equation x = x^3 + 4*x^2 - 8* x -12
Below is my script:
x = [1,4,-8,-12];
y = roots(x)
I have saved this code in flie_3.m script and numming it and its giving me error as
"Execution of script roots as a function is not supported:"

Accepted Answer

Kojiro Saito
Kojiro Saito on 6 Jul 2021
It seems you have another roots.m file which is different from MATLAB's built-in roots function.
Please check the following command
which roots -all
You will get custom roots.m (in bold) and built-in roots.m files.
<SOME_PATH>\roots.m
<MATLAB_ROOT>\toolbox\parallel\gpu\@gpuArray\roots.m % gpuArray method
<MATLAB_ROOT>\toolbox\matlab\polyfun\roots.m % Shadowed
Rename the custom roots.m file to such as myRoots.m.
  4 Comments
Prasannjeet Singh
Prasannjeet Singh on 13 Jan 2023
Facing the same issue. There is just one root file but still receiving this error. Could you help? Thanks.

Sign in to comment.

More Answers (1)

McYvans Frank
McYvans Frank on 26 Feb 2023
Edited: McYvans Frank on 27 Feb 2023
"Execution of script <psat> as a function is not supported: C:\Program Files\Polyspace\R2021a\toolbox\psat\settings.m"
For my case, I was adding psat library to Matlab.
Upon following this tutorial https://youtu.be/wqBHO2kzKB0, I realized person installed the library to a latter version 2016. So libraries are compatible to versions. Here's how I did to make mine work with 2021: -Downloaded and extracted PSAT 2.1.11 -Instead of following the path from video, kept the extracted PSAT folder in "picture" folder in desktop. I did drop in the toolbox folder and still got the same error, reason why I changed folder. -Follow same procedure to set path and everything -Created a new file and saved successfully.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!