[go: up one dir, main page]

0% found this document useful (0 votes)
58 views9 pages

Part9 - Mtidimensional Arrays Part 1

This document discusses multidimensional arrays in Matlab. It covers creating and indexing multidimensional arrays using additional subscripts beyond the two for matrices. Methods include generating arrays using indexing, extending existing arrays, and using functions like randn, ones, zeros. It also discusses accessing properties of multidimensional arrays using functions like size and accessing elements. The document is presented by Mohammad Emad Arafah in a YouTube video series on Matlab.

Uploaded by

JOHN DEERE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views9 pages

Part9 - Mtidimensional Arrays Part 1

This document discusses multidimensional arrays in Matlab. It covers creating and indexing multidimensional arrays using additional subscripts beyond the two for matrices. Methods include generating arrays using indexing, extending existing arrays, and using functions like randn, ones, zeros. It also discusses accessing properties of multidimensional arrays using functions like size and accessing elements. The document is presented by Mohammad Emad Arafah in a YouTube video series on Matlab.

Uploaded by

JOHN DEERE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Matlab With

Mohammad Emad Arafah

Part 9- Multidimensional Arrays

1- Creating, Indexing Multidimensional Arrays 2- Accessing Multidimensional Array Properties


3- Indexing Multidimensional Arrays 4- Reshaping Multidimensional Arrays
5- Permuting Array Dimensions 6- Computing with Multidimensional Arrays
7- Organizing Data in Multidimensional Arrays 8- Multidimensional Cell, Structure Arrays

Email: Mohammad_Arafah@Hotmail.com
YouTube: http://www.youtube.com/channel/UCJ-YdxBHdbLFz-mLYWC4c0w
Facebook : Mohammad Emad Arafah
1- Creating, Indexing Multidimensional Arrays
An array having more than two dimensions is called a multidimensional array in the MATLAB application.
Matrices have two dimensions: the row dimension and the column dimension.
You can access a two-dimensional matrix element
with two subscripts: the first representing the
row index, and the second representing the
column index.
Multidimensional arrays use additional subscripts for
indexing. A three-dimensional array, for example, uses
three subscripts.

The first references array dimension 1, the row.


The second references dimension 2, the column.
The third references dimension 3. This illustration uses the concept of a page to represent
dimensions 3 and higher.
1- Creating, Indexing Multidimensional Arrays

To access the element in the second row, third column of page 2, for
example, you use the subscripts (2,3,2).

Note: Most of the operations that you can perform on


matrices can also be done on multidimensional
arrays
1- Creating, Indexing Multidimensional Arrays
Generating Arrays Using Indexing :
One way to create a multidimensional array is to create a two-dimensional array and extend it.

Extending Multidimensional Arrays :


To extend A in any dimension:

1- increment or add the appropriate subscript and assign the desired values.

2- Assign the same number of elements to corresponding array dimensions. For numeric
arrays, all rows must have the same number of elements, all pages must have the same
number of rows and columns, and so on
1- Creating, Indexing Multidimensional Arrays
You can take advantage of the MATLAB scalar expansion capabilities, together with the colon
operator, to fill an entire dimension with a single value:

Note that after the first two assignments MATLAB pads A with zeros, as needed, to maintain
the corresponding sizes of dimensions.
1- Creating, Indexing Multidimensional Arrays
Generating Arrays Using MATLAB Functions :

You can use MATLAB functions such as randn, ones, and zeros to generate
multidimensional arrays in the same way you use them for two-dimensional arrays.
1- Creating, Indexing Multidimensional Arrays
Building Multidimensional Arrays with the cat Function :

The cat function is a simple way to build multidimensional arrays; it concatenates a list of
arrays along a specified dimension:

where A1, A2, and so on are the arrays to concatenate, and dim is the dimension along which
to concatenate the arrays.
Note: The cat function accepts any combination of
existing and new data.
2- Accessing Multidimensional Array Properties
You can use the following MATLAB functions to get information about multidimensional
arrays you have created.
Thanks For Your Listening

Have A Great Day…

You might also like