drawellipse not working, can't reproduce example

1 vue (au cours des 30 derniers jours)
Yahav Rave
Yahav Rave le 23 Jan 2020
Commenté : Sean de Wolski le 27 Jan 2020
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?

Réponse acceptée

Sean de Wolski
Sean de Wolski le 23 Jan 2020
which -all drawellipse
Looks like you're shadowing this.
  3 commentaires
Image Analyst
Image Analyst le 23 Jan 2020
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 le 27 Jan 2020
They were calling their drawellipse() function with the syntax MathWorks' one expects. So the inputs didn't line up and got propagated to cos().

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 23 Jan 2020
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 commentaires
Image Analyst
Image Analyst le 23 Jan 2020
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 le 23 Jan 2020
Probably drawellpise itself, I doubt MW functionality would be algorithmic by line 22.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by