Make a program to convert a number to decimal, octal, hexadecimal and binary value

Hi guys, i really need your help with my project:
I need a program that convert a number to decimal, binary, hexadecimal or octal value.
I'am working on GUI and i have on my GUIDE the next things:
2 popupmenu
2 edittext
Well, i was thinking i could do a simple conversor (like google conversor).
And the edittext1 i enter the number to convert, then i choosee on the popupmenu1 what value is it(it can be decimal, binary, hexadecimal or octal value)
after that, i choose on the popupmenu2 what value i wanna convert and that value will be set on the edittext2.
I'am a beginner here,guys i hope you can help me with the code, please, help me with a code with the native variables(like edittext, popupmenu, etc).
Thanks ☺
I've attached a pic of my GUI.

2 Commenti

The question is very general. Please ask a specific question to allow us to post an answer.
I need the code for make the conversor Mr. :(
I'am a beginner and i don't know how to do it. Can you help me please?

Accedi per commentare.

 Risposta accettata

You can use the functions
bin2dec
dec2bin
hex2dec
dec2dex
and the more general
dec2base
base2dec

7 Commenti

Thanks Mr Freschi.
But can you help me with the code please?
I don't know how to do that conversor, i'am new here.
once you get the number from the text box, check the values of the pulldown menus, then use a multiple if-statement
if (fromFormat == 'binary') && (toFormat == 'decimal')
output = bin2dec(input);
elseif ...
% other cases
end
But where i declarate the variales Mr? and how i do it?
Please help me, i'am looking on youtube but i don't found nothing. :(
Can you help me with a 'switch' setence?
switch clause evaluate an expression, but your check is rather complicate. IMO a multiple if is simpler
Oh i see, can you help me with the entire code please?
I need your help. :(

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Simulink in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by