Variable number of output arguments - function, MATLAB Programming

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 =


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

arrtype =


len =


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

arrtype =


r =


c =


Posted Date: 10/22/2012 1:19:50 AM | Location : United States

Related Discussions:- Variable number of output arguments - function, Assignment Help, Ask Question on Variable number of output arguments - function, Get Answer, Expert's Help, Variable number of output arguments - function Discussions

Write discussion on Variable number of output arguments - function
Your posts are moderated
Related Questions
#create a matlab GUI for designing common emitter amplifier which produces AC load lines based on the component values

The natural frequencies of a fixed-fixed uniform shaft made of homogeneous material undergoing longitudinal vibration is given by rad/s, where L is the length of the bar, G is th

MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions

Barrier Option pricing in Matlab using MC simulation or finite difference methods

Example of Referring elements: the vector can also be extended. For illustration, the following generates a vector which has three elements. And then referring to the fourth e

logical operators: The logical operators are as shown below: All the logical operators operate on Boolean or logical operands. The not operator is a unary operator; wh

I have an assignment to do by MATLAB : the assignment is to design Script that makes (Panorama Stitching) for multiple pictures .. for more information see the link :

what are the steps we need to write in the script to get themedian for X values

Referring to and Modifying Elements: The particular element in a vector is accessed by using the name of the vector variable and the element number (or subscript, or index) in