Code Comments
Programming Forum and web based access to our favorite programming groups.Perhaps the varargout stuff obscures my main question. For the purposes of this example I'm assuming that nargout = 5. I think my problem comes down to whether or not the use of deal can be combined with array indexing. I don't really want to have to form a string with a variable amount of entries and then plug that into deal: I don't really want to have ? = deal(x_1,x_2,...,x_k) with the argument string made from a for loop. Can I do something like X = [x_1, x_2, ... x_k] ? = deal(X(column 1:column k)) or ? = deal(X)(column 1:column k)
Post Follow-up to this messageIn article <d79li4$17tl$1@godfrey.mcc.ac.uk>, mcross@ma.man.ac.uk
says...
> Perhaps the varargout stuff obscures my main question. For the purposes of
> this example I'm assuming that nargout = 5. I think my problem comes down
to
> whether or not the use of deal can be combined with array indexing. I don'
t
> really want to have to form a string with a variable amount of entries and
> then plug that into deal: I don't really want to have
> ? = deal(x_1,x_2,...,x_k)
> with the argument string made from a for loop.
> Can I do something like
> X = [x_1, x_2, ... x_k]
> ? = deal(X(column 1:column k))
> or
> ? = deal(X)(column 1:column k)
>
>
>
Make X a cell array:
X = {x_1 x_2 ... x_k}
Then, in R14, you don't even need to use deal. You can simply do this:
varargout(1:length(X)) = X{:};
and that will distribute the results.
--Loren
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.