How to compare pair of rows in a column and report it in hexadecimal format
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Farhan K
le 27 Fév 2020
Réponse apportée : David Hill
le 27 Fév 2020
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 commentaires
KSSV
le 27 Fév 2020
idx = ROW1 > ROW2 ;
The above will be logical 0 and 1. Are you looking for this?
Réponse acceptée
David Hill
le 27 Fév 2020
Try this:
x=reshape(mymatrix,2,[])';
y=num2str(x(:,1)>x(:,2))';
y=dec2hex(bin2dec(reshape(y(y~=' '),8,[])'))';
hexRep=y(:)';
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Database Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!