필터 지우기
필터 지우기

floating point quantization

조회 수: 2 (최근 30일)
God'sSon
God'sSon 2011년 3월 25일
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!

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 3월 25일
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
God'sSon
God'sSon 2011년 3월 25일
thanks for your answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by