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

Illustrations of calling the function, Illustrations of calling the functio...

Illustrations of calling the function: Here are illustrations of calling the function: >> cylcost(32,73,4.50) ans = 661.5000 >> fprintf('The cost would be $%.2f\n'

Simulation of a transmission system, Simulation of a transmission system wi...

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

Solution, Write a function that will take in a simplex tableau and an assoc...

Write a function that will take in a simplex tableau and an associated basis, and return the initial feasible solution of the tableau x as a column vector, as well as the objective

Rungakuta methord, the basic equation of modeling radioactive decay is wher...

the basic equation of modeling radioactive decay is where the amount of the radioactive substance is at time and is the decay rate. Some radioactive substances decay into other rad

linear differential equation in matlab, Problem 1:   What are the di...

Problem 1:   What are the different methods that can be used to solve a differential equation? Please provide a numbered list. Problem 2:   For a first order linear d

EMG, How to make EMG analysis by Matlab?

How to make EMG analysis by Matlab?

Finite difference method, Finite Difference Method for An Elliptic Partial ...

Finite Difference Method for An Elliptic Partial Differential Equation   Problem  Use the finite difference method and MatLab code to solve the 2D steady-state heat equat

Find the volume if pyramid, Write a script to determine the volume of a pyr...

Write a script to determine the volume of a pyramid, which is 1/3 * base * height, where the base is length * width. On time the user to enter values for the length, width, and th

Estimate the sample mean and sample standard deviation, The fuel consumptio...

The fuel consumption of a certain make of car may not be exactly that rated by the manufacturer. Suppose ten cars of the same model were tested for combined city and highway fuel c

Real time color recognition, Hello my name is lalitkumar and I am a student...

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

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