Code covered by the BSD License  

Highlights from
Assign the same values to many output variables

Be the first to rate this file! 19 Downloads (last 30 days) File Size: 1.33 KB File ID: #35517

Assign the same values to many output variables

by

 

MANY takes in the variable x and assign it to all the output variables.

| Watch this File

File Information
Description

MANY takes in the variable x and assign it to all the output variables.

This function works as the equation sign in C++ so that the following expression in C++:

x1 = x2 = x3 = x4 = x5 = 8;
    
is equivalent to the following expression in MATLAB:

[ x1, x2, x3, x4, x5 ] = MANY( 8 );

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
09 Mar 2012 Jan Simon

I do not assume that PARFOR is helpful here. Is it? This looks simpler and is faster:
varargout = cell(nargout, 1); varargout(:) = {x};
Anyhow, I'd stay at DEAL.

08 Mar 2012 Eric

Of course

[x1, x2, x3, x4, x5] = deal(8);

using Matlab's built-in deal() function does the same thing.

Contact us