Filter löschen
Filter löschen

floating point quantization

2 Ansichten (letzte 30 Tage)
God'sSon
God'sSon am 25 Mär. 2011
hello, I am working on an audio compression project as my final year dissertation in which I need to implement floating point quantization. I am stuck at a stage where i need to count the number of leading zeros in my array. can anyone please help me with this algorithm.
1 0 0 0
0 0 1 1
0 1 1 0
0 1 0 1
0 0 0 1
0 1 1 0
0 0 1 1
1 0 0 0
what I want is a fifth column that has the numers of leadind zeros in each row. So from the array above, my fifth coulmn should be 0 2 1 3 1 2 0
cheers!

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 25 Mär. 2011
a=[1 0 0 0
0 0 1 1
0 1 1 0
0 1 0 1
0 0 0 1
0 1 1 0
0 0 1 1
1 0 0 0];
b=cumsum(a,2);
c=b==0;
d=sum(c,2)
  1 Kommentar
God'sSon
God'sSon am 25 Mär. 2011
thanks for your answer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by