Simple code that allows multiple assignment between two sets of variable. The two sets must have the same number of elements and listed on the same order.
%example 1
[a,b,c]=multiAssig(1,2,3)
a=1
b=2
c=3
-------------
%example 2
[outVar1,outVar2,...,outVarN]=multiAssig(inVar1,inVar2,...,inVarN)
outVar1=inVar1
outVar2=inVar2
...
outVarN=inVarN
Francesco (2021). Multiple variables assignment varargout=multiAssig(varargin) (https://www.mathworks.com/matlabcentral/fileexchange/50730-multiple-variables-assignment-varargout-multiassig-varargin), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.