Cody

Problem 2046. Convert binary numbers to hexadecimal numbers

Solution 2943832

Submitted on 13 Sep 2020 by Benjamin
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] ; y_correct = 'F0 E1'; assert(isequal(bin2hex(x),y_correct));

2   Pass
x = ones(1,80); y_correct = 'FF FF FF FF FF FF FF FF FF FF'; assert(isequal(bin2hex(x),y_correct));

3   Pass
x = zeros(1,8); y_correct = '00'; assert(isequal(bin2hex(x),y_correct));

4   Pass
x = '1 0 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0'; y_correct = '9E 6B E2 9A'; assert(isequal(bin2hex(x),y_correct));

Suggested Problems

Community Treasure Hunt

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

Start Hunting!