The reason you are getting that error is because you are trying to store an 8-bit binary string (dec2bin(k2,8)) in a double array index with 1 row ( Quant(k1)). MATLAB does not like this.
I'm not sure what you want Quant to look like, but 2 options are:
- Make Quant a cell array of length(y) and store the binary strings in each cell.
- Make Quant have 8 rows (or columns depending on your desires), and store the 8-bits that way.