[1 0 1 1 0 1 1 0] to [10 11 01 10]?
1 次查看(过去 30 天)
显示 更早的评论
I need to transform 8 numbers into 4 like the title, how could i do that?
3 个评论
James Tursa
2019-6-1
"Numeric formats do not store leading digits"
I know what you meant by this (floating point formats), but in fact all of the integer formats store leading digits. For these formats it is more of a display issue rather than a storage issue.
James Tursa
2019-6-2
@Stephen: I was responding to your blanket statement ... not to OP directly. E.g., the leading bits of 2's complement integers are physically stored, regardless of whether the MATLAB doc talks at this level or not.
采纳的回答
Walter Roberson
2019-6-1
V = [1 0 1 1 0 1 1 0];
one_way = V(1:2:end) * 10 + V(2:2:end)
another_way = reshape(V, 2, []).'
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!