[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Opinions on Matlab compatibility, Octave development
From: |
Søren Hauberg |
Subject: |
Re: Opinions on Matlab compatibility, Octave development |
Date: |
Wed, 02 Jun 2010 14:14:35 -0700 |
ons, 02 06 2010 kl. 14:11 -0700, skrev bpabbott:
> On Jun 02, 2010, at 05:00 PM, Judd Storrs <address@hidden> wrote:
>
>
> > 2010/6/2 Jaroslav Hajek <address@hidden>:
> > > I don't think it's that bad. Surely, the necessity to parenthesize
> > the
> > > keywords is a bit of burden, but otherwise the approach is
> > basically
> > > equivalent, from a user point of view, to other languages with
> > > explicit keyword arguments, like Python (I don't know IDL but I
> > assume
> > > it's similar there). The positive is that it doesn't need a
> > special
> > > syntax, and using runtime-constructed argument lists is natural. A
> > > disadvantage is that parsing is difficult, but a lot can be
> > handled by
> > > extra funcs (cf. Octave's new parseparams).
> >
> > One of the things that is easy in IDL that I occasionally wish I
> > knew
> > how to do easily in octave is to write fully functional wrapper
> > functions. I've never succeeded in doing this simply in
> > octave/matlab
> > but probably it's a limitation of my octave/matlab skills.
> >
> > As a simple exercise, how does one create a wrapper to plot() that
> > simply adds "markersize",3 to the property list and then calls plot?
> > This doesn't work:
> >
> > function myplot(varargs)
> > return plot(varargs, "markersize",3)
> > endfunction
> >
> > plot(1:4,"*","markersize",3)
> > myplot(1:4,"*")
> > myplot(1:4,"*","color","red")
> >
> > I've tried other things but I haven't figured it out. Bonus points
> > if
> > you figure out how to get it to work with varargout functions.
> >
>
>
> I haven't tested it, but this should work
>
>
> function h = myplot (varargs)
> h = plot (varargs{:}, "markersize", 3);
> endfunction
Or if you just want to do this locally
myplot = @(varargin) plot (varargin {:}, "markersize", 3);
Søren
- Opinions on Matlab compatibility, Octave development, Jordi Gutiérrez Hermoso, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Jaroslav Hajek, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Sergei Steshenko, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, John Swensen, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Jaroslav Hajek, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Emmanuel FARHI, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, bpabbott, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development,
Søren Hauberg <=
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/02
Re: Opinions on Matlab compatibility, Octave development, fork, 2010/06/02
- Re: Opinions on Matlab compatibility, Octave development, CdeMills, 2010/06/04
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/04
- Re: Opinions on Matlab compatibility, Octave development, John W. Eaton, 2010/06/04
- Re: Opinions on Matlab compatibility, Octave development, Judd Storrs, 2010/06/04
- Re: Opinions on Matlab compatibility, Octave development, Jordi Gutiérrez Hermoso, 2010/06/04