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 =

s

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

arrtype =

v

len =

  3

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

arrtype =

m

r =

2

c =

3

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
Hello my name is lalitkumar and I am a student.I needed help in MATLAB for recognition of colour randomly using webcam realtime for RGB without external trigger.please mail the co

Call to length function: The call to length function consists of the name of the function, followed by an argument in the parentheses. This function takes the argument, and re

Water flow varies with water pressure. Two studies were made and two equations were developed: Parabolic fit:  F = 59.60180 + 3.77965 P - 0.01536 P 2       P

Functions which return More than one Value: Functions which return one value have one output argument. The Functions which return more than one value should rather have more t

Micro-mouse is an engineering design competition created by IEEE in the late 1970s. Small robotic "mice" solve a 16x16 cell maze. The mice are completely autonomous and must find t

Plot way forms for the following modulation schemes using Mathlab: a)      2 ASK                     b)  BFSK                        c) BPSK 4 ASK

please tell me how to compress a video in matlab

i want to save the values of a particular equation in a for loop.. for ex: for i=1:100 et=(x+yz); end thus how can i store the values of et at each iteration

Illustration of a conditional loop - While loop: As an illustration of a conditional loop, we will write a function which will find the first factorial which is greater than t

Simple Related Plot Functions: The other functions which are useful in customizing plots are the figure, clf, hold, leg-end, and grid. The short description of such functions