representing 8 bits per element

1 次查看(过去 30 天)
In the previous post
walters comment
Remember, comp is representing binary, and so is 1 bit per element, whereas your original data is at least 8 bits per element.
now how to represent binary element as 8 bits per element
binary values are stored in comp
  1 个评论
Image Analyst
Image Analyst 2012-12-27
Why wasn't this posted in that previous post then? Why did you start a whole new discussion?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2012-12-27
Provided your vector comp is an exact multiple of 8 long:
x = comp; %just to make the writing shorter
uint8( x(1:8:end) * 128 + x(2:8:end) * 64 + x(3:8:end) * 32 + x(4:8:end) * 16 + x(5:8:end) * 8 + x(6:8:end) * 4 + x(7:8:end) * 2 + x(8:8:end) )
  6 个评论
Walter Roberson
Walter Roberson 2012-12-27
while length(x) ~= 8 * floor(length(x)/8)
x(end+1) = 0;
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by