MATLAB Guide

Chapter 3: Distinctive Features of MATLAB

MATLAB has three features that distinguish it from most other modern programming languages and problem solving environments. We introduce them in this chapter and elaborate on them later in the book.

3.1 Automatic Storage Allocation

As we saw in Chapter 2, variables need not be declared prior to being assigned. This applies to arrays as well as scalars. Moreover, MATLAB automatically expands the dimensions of arrays in order for assignments to make sense. Thus, starting with an empty workspace, we can set up a 1-by-3 vector x of zeros with

   <span class="unicode">?</span> x(3) = 0   x =       0   0   0

and then expand it to length 6 with

  <span class="unicode">?</span> x(6) = 0  x =      0     0     0     0     0     0

MATLAB's automatic allocation of storage is one of its most convenient and distinctive features.

3.2 Functions with Variable Arguments Lists

MATLAB contains a large (and user-extendible) collection of functions. They take zero or more input arguments and return zero or more output arguments. MATLAB enforces a clear distinction between input and output: input arguments appear on the right of the function name, within parentheses, and output arguments appear on the left, within square brackets. Functions can support a variable number of input and output arguments, so...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Inertial Sensor Chips
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.