You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
383 B
Matlab

function [ s ] = bin2hex( in )
%BIN2HEX Summary of this function goes here
% Detailed explanation goes here
a=reshape(in,8,[]);
t=size(a);
s=cell(1,t(2));
nbit=2.^(7:-1:0);
for i=1:t(2)
s{i}=dec2hex(sum(nbit'.*double(a(:,i))));
end
for i=1:t(2)
if (length(s{i})==1)
fprintf('0%s ',s{i})
else
fprintf('%s ',s{i})
end
end
fprintf('\n');
end