drawellipse not working, can't reproduce example

조회 수: 1 (최근 30일)
Yahav Rave
Yahav Rave 2020년 1월 23일
댓글: Sean de Wolski 2020년 1월 27일
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?

채택된 답변

Sean de Wolski
Sean de Wolski 2020년 1월 23일
which -all drawellipse
Looks like you're shadowing this.
  댓글 수: 3
Image Analyst
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
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
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
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
Sean de Wolski 2020년 1월 23일
Probably drawellpise itself, I doubt MW functionality would be algorithmic by line 22.

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

카테고리

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

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by