How to create a m by n matrix in which each element be another p by q matrix?
Ältere Kommentare anzeigen
I would like to create a 100 by 100 matrix in which each element would be p by q matrix. How? Thanks
Antworten (2)
John D'Errico
am 27 Feb. 2015
You cannot do so, as a regular 2-d matrix. (As Roger pointed out.)
You can do so easily enough however, using a 4-dimensional array.
A = rand(p,q,100,100);
A is a 4-d array. You can create the array in a variety of ways. I used random elements. But now
A(:,:,i,j)
is a pxq matrix, as you desire.
1 Kommentar
Roger Stafford
am 27 Feb. 2015
Good point!
Roger Stafford
am 27 Feb. 2015
2 Stimmen
You cannot do that with matrices. Each of their elements must be a single scalar quantity. However, you can do such things using cell arrays.
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!