Re: Question on Overloaded Functions



Michelle Scala wrote:
I am teaching myself Matlab for a new job.

I understand the concept of overloaded functions from my course work
in C++.

What I don't understand is how do I save 2 or more functions with the
same name in the same directory?

For example, I want to create these an overloaded function - one that
accepts a double and the other that accepts an int.

So I do:

function myFunction (int) and another one that is function myFunction
(double).

Obviously I can't save both files are myFunction.m in the same
directory.

Am am confused as what to do. Thank you for helping.

You create your double version of myFunction.m and put it in a directory
called @double which is in a directory on the MATLAB path. Next you have to
decide which integer data type you are using for the integer version of
myFunction, let's say you choose uint8. Then you put the integer version of
your function in a directory called @uint8 which is in a directory on the
path. Do not add @double or @uint8 to the path.


--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
.



Relevant Pages

  • Question on Overloaded Functions
    ... I understand the concept of overloaded functions from my course work ... accepts a double and the other that accepts an int. ... function myFunction and another one that is function myFunction ...
    (comp.soft-sys.matlab)
  • Re: new to vc++
    ... unambiguous float or double and the function call works. ... >> int main ... > My copy of 7.1 actually lists all overloaded functions it could use. ... Prev by Date: ...
    (microsoft.public.vc.language)