Getting "out of memory" while in for loop in huge matrix
Show older comments
Hi there
So I have a 64x65536 matrix in which I want to extract the first 1:9 coefficients of each row, in other words, I want a 9x65536.
To do that I wrote the following code:
coefT1a9 = zeros(9,65536);
k=1;
for i=0:1:65536
for j=0:1:8
coefT1a9(k,:) = Tzig(j+1,i+1);
k=k+1;
end
k=1;
end
Tzig is the 64x65536 matrix. When I compile the code, I'm getting out of memory, or a really long processing time. I can't understand what am I doing wrong.
If you're wondering what the goal is, basically I have a zigzag matrix with DCT coefficients from an image and I want to take out specific coefficients from a 8x8 block (64 coefficients per block). The first one is the DC coefficient, wich I got, then 1-9, 10-35 and finally 36-63.
Thanks for your help!
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!