필터 지우기
필터 지우기

How to store all the datas of a txt file in some given bits?

조회 수: 1 (최근 30일)
Jiajie Zhang
Jiajie Zhang 2019년 1월 20일
편집: per isakson 2019년 6월 12일
I have a txt like this:
9,15,5,10,14,5,11,15,5,7,19,0,4,22,0
7,8,7,10,8,4,11,7,0,9,12,7,11,11,0
each row has 15 data values; actually it's a set of 5 points with three atrributions.
such as, the first point is (9,15,5),9 and 15 are x and y direction of a point, 5 is the orientation,
I want to use 4 bits to store x and y, 3 bits to store orientation.
and then store all the data after transformation in a new txt file.
The sample of my data is in the attachment.
Anyone know how to solve it?
Thank you so much.
  댓글 수: 2
dpb
dpb 2019년 1월 20일
What is the fi function?
As far as column-major order, simply transpose your array to turn rows to columns.
Jiajie Zhang
Jiajie Zhang 2019년 1월 21일
fi function can change the storige size of the data.
But things are much much complicated than just using transpose.
Do you know how to solve my problem?

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 1월 21일
bits11 = uint16(x) * 128 + uint16(y) * 8 + uint16(orientatation);
However if you want to pack together the 11 bit quantities into words you would need 8 of them together, which would put together 8 such sets of data into 11 bytes. That is a bit more of a nuisance.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by