plot function not working

102 views (last 30 days)
Kashvi Rai
Kashvi Rai on 23 Sep 2021
Moved: Cris LaPierre on 15 Dec 2023
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.
  3 Comments
Ajay Sharma
Ajay Sharma on 15 Dec 2023
Moved: Cris LaPierre on 15 Dec 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 on 15 Dec 2023
Moved: Cris LaPierre on 15 Dec 2023
Rename C:\Users\91999\Documents\MATLAB\plot.m to some name that is not used by MATLAB.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 23 Sep 2021
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.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!