How to fix this error: "Undefined function 'ellipsoiddrag' for input arguments of type 'double'."

1 view (last 30 days)
Function 'ellipsoiddrag' calculates the aerodynamic drag of an ellipsoid. The error message appeared out of the blue when I tried to execute the function. When I tried to execute another function which had worked two days ago, I got the same error. What have I done and how do I fix it?

Accepted Answer

James Tursa
James Tursa on 17 May 2013
Check that the functions are in a directory that is on the MATLAB path, or that the functions are in the current directory. It could be that two days ago the current directory happened to be the directory with the functions in it (which is why they worked) but today your current directory was something else (which is why they weren't found).
  2 Comments
Eric
Eric on 20 May 2013
Dear Mr. Tursa,
Your suggestion was spot on. I had created a subdirectory for functions like ellipsoiddrag.m, but had forgotten to put it on the path. Thank you.
However, I would like to point out that the error message "Undefined function 'ellipsoiddrag' for input arguments of type 'double' is ambiguous. Does it mean that the function is undefined "for" certain input arguments? You correctly interpreted it as an "undefined function." In other words, the error had nothing to do with the input arguments. (I had another person confirm this; he, too, was misled.) I suggest that the error message simply say "undefined function." Or even better, "Can't find function [name]; not in any directory on the path."
Walter Roberson
Walter Roberson on 20 May 2013
MATLAB uses method resolution based upon the datatype of the first argument (usually!) so you could, for example, have a defined method named ellipsoiddrag that was in the uint16 namespace but was not in the double namespace. You need both pieces of information, the name and the datatype, to properly investigate missing functions.

Sign in to comment.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!