Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Cell arrays, more elegantly (addendum)
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)



Report this thread to moderator Post Follow-up to this message
Old Post
Mat Cross
05-28-05 08:59 PM


Re: Cell arrays, more elegantly (addendum)
In 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

Report this thread to moderator Post Follow-up to this message
Old Post
Loren Shure
05-31-05 09:05 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:38 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.