How do I do unsigned comparsion between two n-bit vectors having 1s and 0s?
3 次查看(过去 30 天)
显示 更早的评论
x = '1000000100000000000000000000000000000000000001010110001111000000'
y = '0000000000000101011000111100000000000000000001010110001111000000'
Let's say x is the binary representation of a n-bit unsigned number. y is also same.
I want to have unsigned comparison between both of them. That means x(1) and y(1) are the MSB and the comparsion should start from there till we reach LSB. I think if I use bin2dec then there will be a flintmax issue for n>53.
Thanks.
0 个评论
采纳的回答
Chunru
2022-3-29
x = '1000000100000000000000000000000000000000000001010110001111000000'
y = '0000000000000101011000111100000000000000000001010110001111000000'
xs = sym(['0b' x])
ys = sym(['0b' y])
isAlways( xs > ys )
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!