How to create a 5D matrix by repeating a 2D array?
Ältere Kommentare anzeigen
Hello everyone,
I'm trying to create a 5D matrix from a 2D array by repeating it for each array in the 5D matrix. I managed to do it using for loop.
A = zeros(1,70); % 2D array
X = zeros(length(N),length(lg),length(C),length(E),length(A)); %% 5D matrix
for p = 1:1:length(A)
X(:,:,:,:,p)=A(p);
end
Is there any shorter way to do this?
Thanks.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!