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?

采纳的回答

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