How to compare pair of rows in a column and report it in hexadecimal format

1 次查看(过去 30 天)
Hello,
I have a 512x1 matrix (512 rows and 1 column)
The value of ROW1 should be compared with ROW2, similarly ROW3 with ROW4, etc. I have to compute this 256-bit response and report it in hexadecimal format assuming; if ROW1 > ROW2 then 1 & if ROW2 > ROW1 then 0
In this way I will get 256x1 from this.
Please advise!
  2 个评论
Farhan K
Farhan K 2020-2-27
编辑:Farhan K 2020-2-27
Yes but how can I get the output to store in a new 256x1 matrix?
oddrows = MeanofAvg(1:2:end);
evenrows = MeanofAvg(2:2:end);
if oddrows > evenrows
oddrows = 1;
else
oddrows = 0;
end
I am stuck here, dont know how to proceed further.

请先登录,再进行评论。

采纳的回答

David Hill
David Hill 2020-2-27
Try this:
x=reshape(mymatrix,2,[])';
y=num2str(x(:,1)>x(:,2))';
y=dec2hex(bin2dec(reshape(y(y~=' '),8,[])'))';
hexRep=y(:)';

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by