Code covered by the BSD License

### Highlights from NUMBER SYSTEMS/ BASE CONVERTER

• NUMBER SYSTEMS BASE CONVE...Convert a number between different number systems-hex,oct,bin,dec.
• array_adder(array1,array2)This function adds 2 arrays, after making them of equal lengths by appending with reqd number of zeros.
• bin2hex(input)This function converts a single-digit binary number into corresponding hexagonal number.
• bin2oct(input)This function converts a single-digit binary number into corresponding octagonal number.
• bin_2_dec(input)This function converts an binary number into corresponding decimal number.
• bin_2_hex(input)This function converts an binary number into corresponding hexagonal number.
• bin_2_oct(input)This function converts an binary number into corresponding octagonal number.
• bincheck(input)This function keeps it same if its a valid number in this system.
• dec2bin2(input)This function converts an array in binary format to an array in decimal format.
• dec_2_bin(input)This function converts an decimal number into corresponding binary number.
• dec_2_hex(input)This function converts an decimal number into corresponding hexagonal number.
• dec_2_oct(input)This function converts an decimal number into corresponding octagonal number.
• deccheck(input)This function keeps it same if its a valid number in this system.
• div2(a)This function divides an array by 2 and calculates the remainder too.
• hex2bin(input)This function converts a single-digit hexagonal number into corresponding binary number.
• hex_2_bin(input)This function converts an decimal number into corresponding octagonal number.
• hex_2_dec(input)This function converts an hexagonal number into corresponding decimal number.
• hex_2_oct(input)This function converts an hexadecimal number into corresponding octagonal number.
• hexcheck(input)This function keeps it same if its a valid number in this system.
• num_sys(varargin)GUI for number system converter.
• oct2bin(input)This function converts a single-digit octagonal number into corresponding binary number.
• oct_2_bin(input)This function converts an octagonal number into corresponding binary number.
• oct_2_dec(input)This function converts an octagonal number into corresponding decimal number.
• oct_2_hex(input)This function converts an octagonal number into corresponding hexadecimal number.
• octcheck(input)This function keeps it same if its a valid number in this system.
• powr2(b)This function calculates the power of 2 with the input as the exponent.
• str2num(a)This function converts a string into an array.
• View all files
3.33333
3.3 | 4 ratings Rate this file 5 Downloads (last 30 days) File Size: 78 KB File ID: #11953 Version: 1.2

# NUMBER SYSTEMS/ BASE CONVERTER

### Divakar Roy (view profile)

13 Aug 2006 (Updated )

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

File Information
Description

Instances:

bin_2_oct('0100101111100100110010010101001010010010101111010011101010010101001')
ans =
4574462251222572352251

bin_2_dec('0100101111100100110010010110100100101001010010010101111010011101010010101001')
ans =
22399866065043652727977

bin_2_hex('0100101111100100110010010110100100101001010010010101111010011101010010101001')
ans =
4BE4C96929495E9D4A9

oct_2_bin('3532432436345324764546435345')
ans =
11101011010100011010100011110011100101011010100111110100101100110100011101011100101

oct_2_dec('3423432323563455432643242435524242445457735325263326453243245342645327')
ans =
727762791843212863701450133737761143418605884024736534705687255

oct_2_hex('3532432436345324764546435345433463427254364534321323123')
ans =
EB51A8F395A9F4B3475CB1B99C5D58F4AE345A653

dec_2_bin('3423432323563455442374874327')
ans =
10110000111111001011111111100010000011010011101010111010110011110001101011111101010011010111

dec_2_oct('3423432323563455432643242435524242445457735325263326453243245342645327')
ans =
77373335764716516477107330113172733565105561077056067173304146511645015456117

dec_2_hex('3423432323563455432643242435524242445457735325263326453243245342645327')
ans =
7EFB6EFD39D4E9F91DB04B3D76EEA45B88FC5C373DB10CD49D28365C4F

hex_2_bin('71253785ae6DEF324534Ff')
ans =
111000100100101001101111000010110101110011011011110111100110010010001010011010011111111

hex_2_oct('7125378512AE32546DEF213ae43535fe2312d23145465787654d2e3c')
ans =
161112336050452706225066757102353441523277610611322142425062570354523227074

hex_2_dec('7125378512AE32546DEF213ae43535fe2312d23145465787654d2e3c')
ans =
11915599092607191739039367662030936125233731628115520027914010439228

Added GUI version for easy usage and added cases where user puts invalid numbers and automatic conversion of lowercase to uppercase when user puts ‘a’ instead of ‘A’. So, it’s rather bug-less at least to me, but yes of course bug-reporting(if any)/reviews/comments are very welcome.

Welcome, to no-limit world :)

MATLAB release MATLAB 8.0 (R2012b)
17 Dec 2007 Brian Farmer

In dec_2_hex.m, add the following lines at the top of the code:

if a == 0
a = '0';
end

When I do this, then at least the dec_2_hex works for what I am doing.

17 Dec 2007 Brian Farmer

smaller numbers result in a hang-up. Small numbers like o, 12, 99. I hope the author fixes this fast. I'd like to use these files. Pretty good other than the bug(s).

16 Nov 2006 asdf tyyy

Needs Improvement

This will help microprocessor based software developer in converting data to hex or vice versa.