So i have the matrix below, which are the DCT coefficients for an image.
test = 1.0e+03 * 1.1506 -0.0094 -0.0043 -0.0012 -0.0001 -0.0007 0.0003 0.0004 -0.0082 0.0004 -0.0012 0.0007 0.0017 -0.0003 -0.0011 0.0005 0.0008 -0.0002 -0.0015 0.0001 0.0004 0.0010 -0.0002 0.0014 0.0002 -0.0000 -0.0018 0.0010 -0.0018 -0.0005 0.0009 -0.0012 0.0001 0.0001 -0.0024 -0.0008 0.0004 0.0010 0.0011 -0.0001 -0.0012 0.0004 -0.0001 -0.0007 -0.0004 -0.0002 -0.0001 0.0009 0.0003 0.0002 0.0011 -0.0002 -0.0014 -0.0004 0.0000 -0.0004 0.0005 -0.0002 -0.0021 -0.0001 0.0007 0.0005 0.0008 -0.0007
and I'm splitting the matrix above into 4 equal parts since it's an 8×8 matrix. The first part would contain
1.1506 -0.0094 -0.0043 -0.0012 -0.0082 0.0004 -0.0012 0.0007 0.0008 -0.0002 -0.0015 0.0001 0.0002 -0.0000 -0.0018 0.0010
second part would be
-0.0001 -0.0007 0.0003 0.0004 0.0017 -0.0003 -0.0011 0.0005 0.0004 0.0010 -0.0002 0.0014 -0.0018 -0.0005 0.0009 -0.0012
etc..
So i managed to index out the first part, with.
N = 8;test(1:N/2, 1:N/2)
which gave me the first part above. But suddenly, when i want to get the second part and the rest, I'm getting weird outputs as shown.
sec_part = test(1:N/2, N/2+1:N) %2nd part
sec_part = -0.1250 -0.7400 0.3082 0.3531 1.6533 -0.3160 -1.0713 0.5453 0.3779 0.9798 -0.1831 1.3921 -1.8311 -0.4653 0.8852 -1.2236
I was supposed to get:
-0.0001 -0.0007 0.0003 0.0004 0.0017 -0.0003 -0.0011 0.0005 0.0004 0.0010 -0.0002 0.0014 -0.0018 -0.0005 0.0009 -0.0012
but I'm getting the random numbers as shown in sec_part. The same happened for the third part and fourth part. Why is it that only the first part is extracted correctly from the matrix?
Best Answer