필터 지우기
필터 지우기

how to use bin2dec for binary numbers called by elements

조회 수: 1 (최근 30일)
nadia nadi
nadia nadi 2016년 6월 1일
댓글: CS Researcher 2016년 6월 1일
hello every one,
I have a binary matrix
A=[0 0 0;1 0 0;0 1 0;1 1 0;0 0 1;0 1 1;1 0 1; 1 1 1];
and I call each column using
i=1:8
g=[a(i),b(i),c(i)];
h=dec2bin(g)
end
but it gives error, I know that in case
a=['1 0 1'];
a=bin2dec(a)
I get the right result but in my case I don't know how, and I need it to be not expensive please.
I appreciate any ideas. Many thanks,
Nadia

채택된 답변

CS Researcher
CS Researcher 2016년 6월 1일
Do you mean something like this:
bin2dec(num2str(A))
  댓글 수: 2
nadia nadi
nadia nadi 2016년 6월 1일
many thanks CS, it was easy and fine.
CS Researcher
CS Researcher 2016년 6월 1일
You are welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by