Boris
Boris

Reputation: 213

multiple values inside a matrix element matlab?

I want to define a matrix in MATLAB such that each element in matrix has 3 elements ,like if i have a matrix m=[a b;c d] a 2x2 matrix such that the element a has values (k,l) like wise b has value (j,m) and so on .

Upvotes: 3

Views: 147

Answers (1)

Mikhail Genkin
Mikhail Genkin

Reputation: 3460

You can introduce 3-dimensonal matrix. If your matrix size is NxM and each element of this matrix contains k elements, you define matrix B of the size NxMxK. By calling B(2,3,:) you will access all the elements of the entry (2,3).

Alternatively, you can define a cell matrix, so that every entry is cell array.

If you want each element of your matrix to be consisted of only two real elements, you can define complex-valued matrix.

Upvotes: 2

Related Questions