MATLAB Learning Notes (a) unit array

Source: Internet
Author: User

MATLAB Learning Notes (a) unit array

1.floor (x): Take the smallest integer floor (3.18) =3,floor (3.98) =3
Ceil (x): Take the largest integer ceil (3.18) =4,ceil (3.18) =4
2. The element array and the structure are similar in function,
The same point: the storage mechanism of different types of data can be realized by storing different types of data.
Different points: each element of a struct array has members under it, and each member has its own name, and the cell array has no members and members

The name of the gratitude.
3. An array of elements, using [] to denote the element interval, to denote the interval between elements, and to represent the line interval.
For example: c={[1,2],[3,4,5]} is a cell array of 1 rows and 2 columns
c={[1,2];[ 3,4,5]} is a 2-row, 1-column array of cells

Create an empty cell array

Create M row, n column empty cell array

Method One: C=cell (4) or C=cell (bis) creates 4 rows, 4 columns of empty cell arrays

Method Two: C (bis) ={[]} Create 4 rows, 4 columns empty cell array

Create 1 rows, n column empty cell array

Method One: C=cell (1,n)

Method Two: C (n) ={[]}

Create m rows, n column cell arrays and assign values to all cells

c={sequence/matrix/string/value;;;..;}

Create M-row, N-column arrays and assign values to cells of row m, n columns, and other cells as empty

C (m,n) ={sequence/matrix/string/value}

sequence or matrix with [] contains: [1 2 3 4] (Exception: 1:4=[1 2 3 4] sequence represented by a colon)

String with ' ' contains: ' Matlab '

Values do not need to contain

Call the cell of row m, n column to assign value

D=c{m,n}

Assign values to row m, n column units

c{m,n}= sequence/matrix/string/value

Note that the entire cell array operation is C (m,n), where parentheses () are used, and for a cell operation is c{m,n}, with curly braces {}
4. How to implement the connection matrix
Method One: Link operator: []
Method Two: Cat
Method Three: Repmat
5. Method of Matrix Extraction
A= 1 2 3 4 5
6 7 8) 9 10
11 12 13) 14 15
16 17 18) 19 20
(Extracting an element) extracts the elements of the third column of the first row: a (1,3) "or a (9), MATLAB defaults by column to store data, so 3 is

Put it in the 9th place. "
Extract all the elements of the first line (extract a whole line): A (1,:) "Here": "The colon is the wildcard character when all the columns of the element"
Extract all the elements of the third column (by extracting an entire column): A (:, 3)
(extract n rows m column) extracts the second and fourth rows, all elements of the first and third columns: A ([2 4],[1 3])
6. Deletion of matrices
Delete the premise: after the deletion or the matrix or vector, otherwise illegal
Direct blank: []
Example: A (=[)]

Matlab Learning Note (a) unit array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.