I have trouble translating the following code into C, as the format for array indexing in C slightly differs from MATLAB. If I could get some pointers (get it?) as how to translate the following code, I'd greatly appreciate it. I am only stuck at the following lines, as the indexing in C won't allow me to do it as follows:-
b = a(x:x+1, y:y+1);
a(x:x+1, y:y+1) = b;
My code:-
a = [1 2 3 4; 2 3 4 5; 3 4 5 6; 4 5 6 7];
c = dctmtx(2);
q_mtx = [16 11; 12 12];
for x = 1:2:M
for y = 1:2:N
b = a(x:x+1, y:y+1); %<----HOW DO I DO THIS IN C???
b = c*b*c';
b = b./q_mtx ;
a(x:x+1, y:y+1) = b;
end
end
Your help is greatly appreciated! Thanks!
Aucun commentaire:
Enregistrer un commentaire