필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How do i interpret a data received serial ?

조회 수: 1 (최근 30일)
Constantin
Constantin 2013년 5월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
I receive from serial a message(60 bytes) divided in 17 data types.I need to extract 1 data of 4 bytes.I tried to get it byte with byte,and using shifting operation I fused those 4 bytes together.The problem is that those bytes represent a signed int number and I don't know how to convert that binary number into a signed int.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 5월 15일
You do not need to use shifting.
t = [byte1, byte2, byte3, byte4];
t_as_signed = typecast(t, 'int32');
  댓글 수: 1
Constantin
Constantin 2013년 5월 15일
Thank You for your replay,I hope it will work.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by