help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Useless functions in matlab function library.


From: Guillem Borrell Nogueras
Subject: Useless functions in matlab function library.
Date: Tue, 10 Jul 2007 15:14:35 +0200
User-agent: KMail/1.9.5

I'm so sorry if starting a discussion in a help mailing list is completely 
inappropiate...

Thinking about the previous thread...

Is the inline function just a bad, syntactically wrong anonymous function?  
I've always criticized Matlab saying that it needs to seriously sanitize the 
language. I find the inline function completely wrong, it's like an eval 
function used to assign a function to a variable. And David just said that it 
is even slow! (well, in Matlab).  Is the inline function used for any other 
purpose than something that is much better done with an anonymous function? 
(inlining code is a much broader concept)

I taught a bit of matlab in my school of engineering.  I had only six hours to 
taught as much matlab as possible and I never told my students about the 
inline function. Instead, I spent more than an hour trying to make them 
understand what a function handle is.

Do you know any matlab function that is just rubbish?  What parts of matlab 
you think that are completely wrong (like the object orientation 
implementation)?

guillem

On Tuesday 10 July 2007 12:35, David Bateman wrote:
> Guillem Borrell Nogueras wrote:
> > It is much better to use an anonymous function to fit this purpose.
> >
> > In this case would be:
> >>> k = 2
> >>> f = @(x) k*x^2
>
> Well, for Matlab this is true, as the inline functions use Matlab's
> object class whereas anonymous functions are in the matlab
> parser/interpreter itself. So under Matlab anonymous functions are
> significantly faster to use than inline functions. However, under Octave
> inline functions are just a special type of anonymous functions and so
> there is no speed disadvantage.
>
> That being said, yes it is still better to use anonymous functions as
> then you'll have better performance if you share your code with users of
> the other product... Also, the way "inline" finds what are the arguments
> of the function are, is a horrible mess which Octave had to copy for
> compatibility.  Anonymous functions have a much cleaner interface (i.e.
> you are required to define the arguments)..
>
> D.
>
> > To make this thing work you must upgrade to octave 2.9.x.  In earlier
> > versions of octave the anonymous function won't find the constant k.
> >
> > You can find more information about anonymous functions and function
> > handles here:
> > http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.html. look
> > for anonymous functions in the index.
> >
> > guillem


reply via email to

[Prev in Thread] Current Thread [Next in Thread]