Data types that experience matlab

tic ------- matlab timer start

toc ------ matlab time-up

eg:

tic;

exp;

TOC = time; % time assigned to the measured time

 

num2str () to digital converter to a string

 

 

matlab data in a matrix as a unit, a scalar can be seen as a 1X1 matrix, a string is essentially a matrix.

But there is more than a set of matrix it?

The answer is a tuple cell, a tuple can be stored in different data types, but only the same type of data storage matrix.

Can be imagined, the same type of data among the respective elements in a matrix, the matrix after compression, and then combined into a tuple

Tuple enclosed with {}, can be divided mXn tuples, whose dimension is compressed in units of packets.

If A is a tuple, then a () index tuple can also archive all means one (i.e., the type of data cell ), only a {} used to extract the index of the matrix.

When assignment of tuples, the use of a () = `` manner, the need to compress the matrix, particularly a matrix operation on both sides is combined with the use of a ,,} {a {} = ``, can be directly assigned .

In addition, nested tuple may also be implemented between the tuple, i.e., further comprising a tuple, or itself comprising

 

Matrix structure is larger than a set, the structure may comprise tuples, tuples may contain a structure, but can not contain any of a matrix of both.

b = struct ( 'field' value)

Matlab structure of recording attribute information for an object, only a structure of an example of recording information ,, e.g. student (object) has a student number, name, sex and other attributes,

The attributes field is a struct can be used ,, b. Assigned to the field values ​​on a specific field, such as b. Name = 'five hundred sixty-seven'   

So a struct can represent a student (example), you can put more of a tuple struct in which such a tuple can represent a class of students the information,

Also can be placed in the tuple tuple larger, so that you can represent a college student information.

The struct type field can be divided mXn, when the number of dimensions is only a value field when a tuple (a tuple comprising the structure), the dimension of the tuple is the number of fields,

At this time, other non-tuple field of the structure is automatically expanded into that dimension.

If Dimensions of the fields of a tuple structure is different, the error returns matlab

 

 

 

Published 29 original articles · won praise 3 · Views 3388

Guess you like

Origin blog.csdn.net/qq_41601836/article/details/104995556