Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
dec2hex error

Subject: dec2hex error

From: Leyo Joseph

Date: 8 Oct, 2012 15:28:06

Message: 1 of 2

I have a variable clip1=6.51.
Making the following calculation and getting error==>

cl1 =


>> dec2hex(cl1)
??? Error using ==> dec2hex at 27
First argument must contain non-negative integers.



ans =


works well.

Not able to figure this out?

Subject: dec2hex error

From: Bruno Luong

Date: 8 Oct, 2012 16:03:16

Message: 2 of 2

>> x = 10^(-clip1/10)*2^17

x =


>> fractionx = x - round(x)

fractionx =


>> fractionx == 0

ans =


>> dec2hex(round(x))

ans =


% Bruno

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us