"Attempt to execute SCRIPT polar as a function" error

조회 수: 7 (최근 30일)
Abhilash Nair
Abhilash Nair 2020년 4월 1일
댓글: Ameer Hamza 2020년 4월 1일
I am using R2015a version of Matlab. I have measured the flow velocities of a fluid at different points of a circular pipe. I looked up the examples of polar plots in Matlab and thought of entering the measurements in a polar plot. Since, I'm a beginner I thought of trying the sample code in the software's help directory
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
figure
polar(theta,rho,'--r')
I ran the above commands in the command window directly and got this error.
Attempt to execute SCRIPT polar as a function:
D:\M\toolbox\matlab\graph2d\polar.m
Based on questions on similar problems, I realised that there is a file in my drive which shares the same name as the polar function. However, on searching I found 14 other files of the same name in the D:\M folder, all of them showing dates of 2014 and below. I wonder if these files are important for the software since the answers recommend deleting or renaming the files.
Would appreciate some assistance!

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 1일
It seems like somehow the polar.m file accidentally got overwritten. Although you found 14 files, MATLAB still found the correct one on its path toolbox\matlab\graph2d\polar.m (this is the correct location of polar.m from the MATLAB toolbox), but somehow even that file is not correct. I suggest to uninstall MATLAB and delete the M directory before reinstalling MATLAB again.
  댓글 수: 2
Abhilash Nair
Abhilash Nair 2020년 4월 1일
Thank you, I did as you told and now I'm able to get the polar plots. Those 14 files are still available in my system after re-installation but it doesn't seem that they will cause any problem.
Another doubt, is it possible to create a 2D countour on polar plots in the R2015a version?
Ameer Hamza
Ameer Hamza 2020년 4월 1일
Yes, I appear from you error message that those files are not on MATLAB's path and will not cause any issue unless you add them to the path.
I am not quite sure how to do that. Maybe something like this will help: https://www.mathworks.com/matlabcentral/answers/375341-contour-plot-of-polar-coordinates

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by