From: Patricia Rosales on
Hello,

I am trying to concatenate an array of 650240 elements (in binary), by consecutive pairs, in order to obtain the decimal number that represents each pair. The obtained number is stored in the Y array.
Obviously the order i concatenate the elements is very important, that is why i havenĀ“t used the reshape function.
But this takes around 30 minutes. Someone could give me a hint to solve this?

Thank you!

Y=[];
R=fread(fid,elements,'uint8',0,mformat)';
Z=dec2bin(cast(R,'uint32'),8);

for n = 1:2:elements-1
Y=[Y;bin2dec([Z(n,:),Z(n+1,:)])];
end