필터 지우기
필터 지우기

Creating variables larger than 8 bytes to pass between functions

조회 수: 3 (최근 30일)
tybo1mos
tybo1mos 2018년 8월 23일
댓글: Walter Roberson 2018년 8월 23일
I'm reading bytes from different places in a recorded data log file. Each byte that is read is are placed in an large double array (time, value1, value2 etc) which is then passed to another function. Each time I read a new byte I bit shift the previous value and add on the newly read value. Doing this i'm limited to using only 8 bytes for value1, value2 etc. Is there a way to create a variable that is say 16bytes in length that can be used for the bitshift. This 16byte variable would be placed in the array for a specific time value, and passed to another function to parse and decode.
  댓글 수: 2
tybo1mos
tybo1mos 2018년 8월 23일
Still having some troubles with my original data being changed. I'm trying to take a hex value such as: 31A2B3C4D5E6F7A8 (decimal=3576618712069240744) example: a=fi(3576618712069240744,0,80,0); >> x.hex ans = '000031a2b3c4d5e6f800'
This does allow me to now do a bitshift and add more vlaues, however the right 3 bytes not coming out to the original value that I entered? Any idea what i'm doing wrong?
Walter Roberson
Walter Roberson 2018년 8월 23일
a = fi(uint64(3576618712069240744),0,80,0)

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 8월 23일
Yes, if you use the Fixed Point Toolbox, such as https://www.mathworks.com/help/fixedpoint/ref/fi.html . My memory is that the limit is 32767 bits, but I am not certain of that at all and I am having difficulty finding the reference. A limit of 1023 bits is also coming to mind.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by