Warning: Function class has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict

47 ビュー (過去 30 日間)
Hi everyone!
I'm trying to run a script that suposses to display a plot; however, MATLAB just shows an empty pop up as well as warning messages:
Warning: Function class has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential
name conflict.
The name of the script is pongball.m, and I have changed it but it doesn't work. I had the R2020a version and I already unistalled it and installed the R2021a version but nothing's changed.
I tried to run another script with a plot, just to see if the problem was my code but it doesn't work either:
close all;
x = 1:0.5:10;
y = x.^2;
plot(x,y)
Does anyone know what is the problem?
Thanks in advance :)
Abby

採用された回答

Steven Lord
Steven Lord 2021 年 9 月 14 日
You've created or downloaded a file named class.m that's preventing MATLAB from calling the built-in class function. Identify that class.m file using which and rename or remove it. Anything under matlabroot you're probably okay leaving in place. Look for class.m files outside matlabroot.
which -all class
built-in (/MATLAB/toolbox/matlab/datatypes/class) /MATLAB/toolbox/matlab/graph2d/@scribehandle/class.m % Shadowed scribehandle method /MATLAB/toolbox/instrument/instrument/@udp/class.m % Shadowed udp method /MATLAB/toolbox/instrument/instrument/@i2c/class.m % Shadowed i2c method /MATLAB/toolbox/instrument/instrument/@gpib/class.m % Shadowed gpib method /MATLAB/toolbox/instrument/instrument/@icdevice/class.m % Shadowed icdevice method /MATLAB/toolbox/instrument/instrument/@visa/class.m % Shadowed visa method /MATLAB/toolbox/instrument/instrument/@tcpip/class.m % Shadowed tcpip method /MATLAB/toolbox/instrument/instrument/@Bluetooth/class.m % Shadowed Bluetooth method /MATLAB/toolbox/instrument/instrument/@icgroup/class.m % Shadowed icgroup method /MATLAB/toolbox/matlab/serial/@serial/class.m % Shadowed serial method
  1 件のコメント
Lydia Abigail Garza Coello
Lydia Abigail Garza Coello 2021 年 9 月 14 日
Thanks a lot! As you mentioned, I created a script with that name, I renamed it and now my code works.
-Abby :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by