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
Solve the optimality condition for each P equation against M according to the following relation: Condition for Optimality:         ∇ M = λ ∇ P      with respect to C and T.

Introduction to File Input/output (LOAD and SAVE): In most cases, the input to a script will come from a data file which has been generated by the other source. It is also use

How to design a FIR filter using ANFIS in MATLAB

How to Open Simpower: 1. Open MATLAB 2. In the "Command Window" write ' simulink ' and press Enter or click on the Simulink icon. 3. Simulink Library Browser w

Digging the Dirt: Autonomous Mining Robots   Mining is a multi-billion dollar industry and a critical part of the Australian economy. Much of the day-to-day work on mining sites

The diagram shown on the next page represents a planar pantograph-based leg for a walking robot. This model utilizes only one DOF to generate the walking gait at the foot link 'n

Hi I''m wondering if someone can help me with Matlab coursework

Simulation of a transmission system with a 4-fsk modulation scheme; using non-coherent detection method and an awgn channel. System description: 1. Input: A. Random binary

Algorithms: Before writing any computer program, it is very useful to first outline the steps which will be essential. An algorithm is the series of steps required to solve a

Your task is to implement the PHYSAT algorithm in Matlab to classify the phytoplankton species in the data you have selected. An algorithm demonstrating one solution is provided be