Write a Matlab Function file that takes one integer in and converts it to an integer with only 5 significant digits.(adsbygoogle = window.adsbygoogle || []).push({});

Eg Trunc(123)--------ans=123

Tunc(123345678) ----ans=12345e+03

----------------------------------------------------------------------------------------

My thoughts

First see that the max number that doesn't get truncated is 99999.

set up some logic

if n>99999

insert logic

else

n=n

(n is the value passed into the function).

Can anyone give us a hand?????

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Truncating a number

**Physics Forums | Science Articles, Homework Help, Discussion**