Sometimes you need your function accept variable number of arguments or return variable number of output arguments. In MATLAB, it is easily done by these commands:
nargin
varargin
nargout
varargout
Using variable number of arguments in function definition, gives you a powerful option in developing your codes. MATLAB does a great job in taking care of this issue.
🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻
varargin stores all of the input arguments supplied by caller in a cell array. Why cell array? Because the input arguments might be of various types, like strings, numbers, or objects. So, You can't store all of them in an array. That's when we need cell arrays.
You can learn more about cell arrays in this #short video:
• Cell Arrays in MATLAB | MATLAB Tutori...
♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦
This video is part of MATLAB Intermediate Course. This course is the successor of Beginner's Guide to MATLAB. So if you are looking for a complete beginner tutorial for MATLAB, Go to this link:
• Beginner's Guide to MATLAB
Please consider hitting the SUBSCRIBE button. Or click on the link below:
https://bit.ly/3q1he3v
So:
If you want to learn MATLAB:
https://bit.ly/3q1he3v
You can also follow me on
Instagram:
/ laplaceacademy
Facebook:
/ laplaceacademy
LinkedIn:
/ laplaceacademy
Twitter:
/ laplace_academy
0:00 - Intro
00:50 - nargin command, number of input arguments
01:49 - varargin, variable number of input arguments in MATLAB
02:57 - varargin, nargout in MATLAB
matlab tutorial
matlab lecture programming
matlab symbolic toolbox
matlab symbolic
matlab syms
matlab course
matlab tutorial
complete matlab tutorial go from beginner to pro
matlab
learn matlab
matlab tutorial
matlab basics
matlab basics tutorial
matlab for beginners
complete matlab course
complete matlab tutorial go from beginner to pro
matlab course
how to learn matlab code with matlab
matlab Simulink
Simulink
simulink matlab
tutorial for beginners
matlab simulink projects
simulink tutorial matlab tutorial for beginners
math functions and symbolic data types
#laplaceacademy #matlab tutorial for beginners