drawellipse not working, can't reproduce example
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to use the function drawellipse.
I have tried to reproduce the example with the Llama image in the help section but I get an error :
imshow(imread('llama.jpg'))
h = drawellipse('center',[50,50])
Undefined function 'cos' for input arguments of type 'char'.
Error in drawellipse (line 22)
[cos(elpar(o,3)) sin(elpar(o,3)); % rotate over phi
How could I be doing something wrong if I'm literally copying the example?
댓글 수: 0
채택된 답변
Sean de Wolski
2020년 1월 23일
which -all drawellipse
Looks like you're shadowing this.
댓글 수: 3
Image Analyst
2020년 1월 23일
Strange. That may be. You may have had your own drawellipse() function, but why did it complain about the cos() function?
Sean de Wolski
2020년 1월 27일
They were calling their drawellipse() function with the syntax MathWorks' one expects. So the inputs didn't line up and got propagated to cos().
추가 답변 (1개)
Image Analyst
2020년 1월 23일
What does this show
>> which -all cos
You should see
built-in (C:\Program Files\MATLAB\R2019b\toolbox\matlab\elfun\@double\cos) % double method
built-in (C:\Program Files\MATLAB\R2019b\toolbox\matlab\elfun\@single\cos) % single method
C:\Program Files\MATLAB\R2019b\toolbox\nnet\deep\@dlarray\cos.m % dlarray method
C:\Program Files\MATLAB\R2019b\toolbox\parallel\parallel\@codistributed\cos.m % codistributed method
C:\Program Files\MATLAB\R2019b\toolbox\parallel\gpu\@gpuArray\cos.m % gpuArray method
If you DON'T, then try this
> restoredefaultpath
and try the example again.
댓글 수: 3
Image Analyst
2020년 1월 23일
It works for us. I just copied and pasted your code and it worked fine. As expected with no error. You should call tech support. You didn't assign cos to something in your script before you ran those lines, did you? Try putting that "which" in your script just before the call to drawellipse and see if there is an extra cos that shows up, like it would if you defined cos in your code somewhere. If not, call tech support and let us know how they resolved it.
Sean de Wolski
2020년 1월 23일
Probably drawellpise itself, I doubt MW functionality would be algorithmic by line 22.
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!