Variable number of output arguments - function, MATLAB Programming

Assignment Help:

Variable number of output arguments:

The variable number of output arguments can also be identified. For illustration, the one input argument is passed to the below function typesize. The function always return a character identifying whether the input argument was a vector ('v'), scalar ('s'), or matrix ('m'). This is returned through the output argument arrtype. In addition, when the input argument was a vector the function returns the length of the vector, and when the input argument was a matrix the function returns the number of rows & columns of the matrix. The output argument varargout is used; and it is a cell array. Therefore, for a vector of length is returned through the varargout and for a matrix both the number of rows & columns are returned through the varargout.

677_Variable number of output arguments.png

>> typesize(5)

ans =

s

>> [arrtype, len] = typesize(4:6)

arrtype =

v

len =

  3

>> [arrtype, r, c] = typesize([4:6;3:5])

arrtype =

m

r =

2

c =

3


Related Discussions:- Variable number of output arguments - function

Strings, Strings: The MATLAB also handles strings that are a sequence ...

Strings: The MATLAB also handles strings that are a sequence of characters in single quotes. For illustration, using the double function on a string will represent the equival

Triple the fundamental frequency, For the signal with four harmonics (first...

For the signal with four harmonics (first to fourth) that can be obtained from the script, do the following: a)  Place the time domain signal for the case in which all the harmo

Vectors and matrices, Vectors and Matrices: The Vectors and matrices a...

Vectors and Matrices: The Vectors and matrices are used to store sets of values, all of which are similar type. A vector can either be a column vector or a row vector. The mat

Write a program to calculates the standard deviation, Write a program that ...

Write a program that reads in numbers (of type double) from a file, stores them in an array, and then calculates the mean, variance, and standard deviation.   Your program shoul

Analytical solution and numerical solution, using 0de 45 how can i get the ...

using 0de 45 how can i get the anlytical and numerical solutions for an equation,,

Expert system, how can i write a programm about maze solver expert system o...

how can i write a programm about maze solver expert system only with if & then

Grid function - plot functions, Grid function: grid shows grid lin...

Grid function: grid shows grid lines on the graph. Called by itself, it is a toggle which turns the grid lines on & off. Alternatively, the commands grid on & grid off can

To change a variable, To change a variable: To change a variable, the ...

To change a variable: To change a variable, the other assignment statement can be used that assigns the value of a different expression to it. Consider, for illustration, the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd