make a 2d matrix into a 3d matrix without a loop
Ältere Kommentare anzeigen
I have a 300x300 matrix. I need to make a 300x300x1024 matrix where each "slice" is the original 300x300 matrix. Is there any way to do this without a loop? I tried the following:
old=G;
for j=2:N;
G(:,:,j)=old;
end
where N is 1024, but I run out of memory.
Know any shorter routes?
thanks for the help
Matt
1 Kommentar
Matt Kindig
am 14 Mär. 2013
G = old(:,:,ones(1,1024))
Antworten (1)
Azzi Abdelmalek
am 14 Mär. 2013
Bearbeitet: Azzi Abdelmalek
am 14 Mär. 2013
B=repmat(A,[1,1,1024])
Kategorien
Mehr zu Loops and Conditional Statements 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!