plot function not working

85 次查看(过去 30 天)
Kashvi Rai
Kashvi Rai 2021-9-23
移动Cris LaPierre 2023-12-15
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 个评论
Ajay Sharma
Ajay Sharma 2023-12-15
移动:Cris LaPierre 2023-12-15
xecution of script plot as a function is not supported:
C:\Users\91999\Documents\MATLAB\plot.m
Please give solution
Walter Roberson
Walter Roberson 2023-12-15
移动:Cris LaPierre 2023-12-15
Rename C:\Users\91999\Documents\MATLAB\plot.m to some name that is not used by MATLAB.

请先登录,再进行评论。

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by