Function Description:
This function swaps the a pair of input variables, provided they are of
the same size (shape).
AUTHOR: Sugato Ray | Created on: 12-AUG-2017 | ray.sugato[at]gmail.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PLEASE ACKNOWLEDGE THE AUTHOR IF YOU USE THIS CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NOTE: X = y and Y = x. This function enables you to write the following
expression (equivalent to Tuples concept in Python).
[X,Y] = swapVars(X,Y);
EXAMPLE:
[X,Y] = swapVars(X,Y);
Check the following steps for step-by-step clarity and fact-checking:
xx = ones(3,3)
yy = zeros(3,3)
[xx,yy] = swapVars(xx,yy)
Note: This function works similar to: 'deal' function
[yy,xx] = deal(xx,yy)
引用格式
Sugato (2025). swapVars(x,y) (https://www.mathworks.com/matlabcentral/fileexchange/64090-swapvars-x-y), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- MATLAB > External Language Interfaces > Python with MATLAB > Call Python from MATLAB > Python Data Types in MATLAB >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!