ranell
ranell

Reputation: 703

Matrix of Matrixes

Is there a simpler way to create a matrix of matrixes:

A first matrix (9 x 32) that contain value (through a loop) for each item. I'll have 8 item, so 8 matrix of (9 x 32). I'll have also 2 condition so 2 * 8 of matrix of (9 x 32).

What is the simplest way to create it?

Upvotes: 1

Views: 128

Answers (2)

chappjc
chappjc

Reputation: 30579

Just do

A = zeros(m,n,8,2)

or

A(m,n,8,2) = 0;

Upvotes: 1

MiltoxBeyond
MiltoxBeyond

Reputation: 2731

According to Documentation you can use various techniques to create each matrix. If you have a specific matrix you need to copy you can use the repmat(M, v, h) function to repeatedly create it. Otherwise to create a multidimensional array you can do:

B = repmat(0, [r c 8 2])

That should give you the matrices you need as a 4 dimensional array, where r is the number of rows, c the columns, 8 the number of repetitions, and 2 conditions. Hopefully that helps you

Upvotes: 2

Related Questions