Code covered by the BSD License  

Highlights from
NUMBER SYSTEMS/ BASE CONVERTER

image thumbnail

NUMBER SYSTEMS/ BASE CONVERTER

by

 

13 Aug 2006 (Updated )

Convert a number between different number systems-hex,oct,bin,dec.

output=hexcheck(input)
function output=hexcheck(input)

% This function keeps it same if its a valid number in this system.
output=input;
check1=sign(length(input-48)-sum(sign(abs(input-48+1)+(input-48+1))))+sign(sum(abs(input-48-22)+(input-48-22)));
check2=sign(sum(sign(abs(input-48-9)+(input-48-9))-sign(abs(input-48-16)+(input-48-16))));
if ( check1 || check2 )
    output ='Invalid Number';
end

Contact us