Hi, i am trying to plot this simple code but my matlab is not supporting plot function as shown in the error, please help me what to do.
t=0:0.001:0.2;
y=t*2;
plot(t,y);
Warning: Function plot has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
> In matlab.internal.getCode (line 22)
In mtree (line 118)
In matlab.unittest.internal.ui.toolstrip.getFileInfoForToolstrip (line 29)
Execution of script plot as a function is not supported:
/MATLAB Drive/plot.m
Error in untitled (line 3)
plot(t,y);
Warning: Function plot has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.

7 comentarios

Stephen23
Stephen23 el 27 de Sept. de 2021
You have a function or script named PLOT, which shadows the inbuilt PLOT function.
Show us the exact and complete output of this command:
which plot -all
Ajay Sharma
Ajay Sharma el 15 de Dic. de 2023
Movida: Cris LaPierre el 15 de Dic. de 2023
xecution of script plot as a function is not supported:
C:\Users\91999\Documents\MATLAB\plot.m
Please give solution
Walter Roberson
Walter Roberson el 15 de Dic. de 2023
Movida: Cris LaPierre el 15 de Dic. de 2023
Rename C:\Users\91999\Documents\MATLAB\plot.m to some name that is not used by MATLAB.
Ramesh
Ramesh el 12 de Mayo de 2024
Execution of script plot as a function is not supported:
D:\MATLAB R2024a\matlab programming\plot.m
Stephen23
Stephen23 el 12 de Mayo de 2024
@Ramesh: rename your script to something else, e.g. MYPLOT.M
Aishwariya
Aishwariya el 5 de Abr. de 2025
Movida: Cris LaPierre el 5 de Abr. de 2025
Execution of script plot as a function is not supported:
/MATLAB Drive/plot.m
This appear in my MATLAB online
Walter Roberson
Walter Roberson el 5 de Abr. de 2025
Movida: Cris LaPierre el 5 de Abr. de 2025
You have created a script named plot.m, and you have code that calls plot() . What are you expecting to have happen?
Are you expecting that MATLAB will look and say, "Oh, my current file name is plot but I am calling plot so I should ignore the fact that my current file is named plot and call the function plot " ?? If so then how should MATLAB handle recursion ? For example what if plot.m contained
if ~exist('counter', 'var'); counter = 0; end
counter = counter + 1;
if counter < 10
plot
end
? Then how would MATLAB tell whether the call to plot inside plot.m is a recursive call to plot.m or is a call to the function plot() ?

Iniciar sesión para comentar.

 Respuesta aceptada

Cris LaPierre
Cris LaPierre el 23 de Sept. de 2021

1 voto

You have saved the script containing your code as 'plot.m'. However, that is the same name as the plot function in MATLAB. Give your script a different name (myPlot.m?) and the error will go away.

Más respuestas (0)

Etiquetas

Preguntada:

el 23 de Sept. de 2021

Movida:

el 5 de Abr. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by