Consider the following snippet of Matlab Code Show/hide Matlab Code Snippet 1 1 I function output argtest (varargin) output - nargin; end Save the code in Code Snippet 1 as a function M-file and call...

Consider the following snippet of Matlab Code Show/hide Matlab Code Snippet 1 1 I function output argtest (varargin) output - nargin; end Save the code in Code Snippet 1 as a function M-file and call it in the Command Window multiple times with differing numbers of inputs and with inputs of different types. Show/hide hint Think about what happens when you change the number of inputs or the type of inputs you used. In the textbox, describe the effect of using varargin as an input, and explain what nargin returns to the Command Window: Show/hide hint Enter answer Does it matter whether the inputs are numbers, vectors, matrices, a string of text, or of any other type? Since varargin is not simply a vector, but what is called a cell array, the elements inside it cannot be referenced in the standard way of which we are familiar with when using vectors or matrices. Add the following 2 lines of code to your M-file argtest.m. varargin(1) varargin(1) These are 2 different ways to index the first element of varargin. One commands indexes the first cell of varargin while the other indexes the variable stored in that cell. Try calling the function argtest in the Command Window with different inputs, e.g. argtest(4,9,5) and argtest (ones(3),1, a). If we need to use an input stored in varargin do we use the indexing command with curly brackets"" or circular brackets")"? Curly brackets e.g. varargin(1) D Circular brackets e.g. varargin(1)

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here