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

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:"

 채택된 답변

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.

댓글 수: 5

Thank you. It was very helpful
there is only file with that name which is the actual file and still it is showing the same error
Facing the same issue. There is just one root file but still receiving this error. Could you help? Thanks.
What output are you seeing for
which roots -all
Thank you Kojiro Saito, it fixed my issue as well!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

McYvans Frank
McYvans Frank 2023년 2월 26일
편집: McYvans Frank 2023년 2월 27일

0 개 추천

"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.

댓글 수: 2

McYvans Frank
McYvans Frank 2023년 2월 27일
편집: McYvans Frank 2023년 2월 28일
The command gives the direction of storage of the psat library.
C:\Users\McYvans\Pictures\psat\psat.m

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 7월 6일

댓글:

2024년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by