Working with binary and hex data

조회 수: 2 (최근 30일)
Konstantin
Konstantin 2012년 5월 30일
I have amount of HEX-words, like 4BC1 2452 62AC .....
I want to make a binary string with it. I'v found decision, but I'don like it, because it isn't Matlab-way. For example I work with 1 word
INIT='6559';
For the fist I make binary string with functions
sREG(1:N)=dec2bin(hex2dec(INIT))';
sREG is a string-type, so the next step - I convert every symbol in double
for i=1:N REG(i)=str2double(sREG(i)); end
It's very long way, so I dont like it. Is the any pre-definded functions in Matlab for solving my problem?

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 5월 30일
eg
h = {'4BC1' '2452' '62AC'};
out = dec2bin(hex2dec(h))-'0';
  댓글 수: 1
Konstantin
Konstantin 2012년 5월 30일
Отличное решение, спасибо :-)

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

추가 답변 (1개)

bes
bes 2012년 5월 30일

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by