From: Edmund on
Hi,

If I have a value of 22.223 and 1.342 , how can I get a result like 22 and 1 only?

I need to eliminate the numbers behind the point and get a whole number instead.

my implimentation is this:

x=2250

x1=x/1000

x1 will have a value of 2.250, and I want to get a value of 2.000 instead.

x2=x/100

x2 will have a value of 22.50 and I want to get a value of 22.00 instead.

Note: I am using Simulink function block so some functions may not work such as mxarray, print and other functions that may be used to solve this problem.

Any help would be really appreciated :)

Thanks
Regards
Edmund
From: us on
"Edmund " <azuro20025(a)hotmail.com> wrote in message <hojalc$ie4$1(a)fred.mathworks.com>...
> Hi,
>
> If I have a value of 22.223 and 1.342 , how can I get a result like 22 and 1 only?
>
> I need to eliminate the numbers behind the point and get a whole number instead.
>
> my implimentation is this:
>
> x=2250
>
> x1=x/1000
>
> x1 will have a value of 2.250, and I want to get a value of 2.000 instead.
>
> x2=x/100
>
> x2 will have a value of 22.50 and I want to get a value of 22.00 instead.
>
> Note: I am using Simulink function block so some functions may not work such as mxarray, print and other functions that may be used to solve this problem.
>
> Any help would be really appreciated :)
>
> Thanks
> Regards
> Edmund

hmm...

help fix;
help floor;

maybe(?)...
us
From: Edmund on
"us " <us(a)neurol.unizh.ch> wrote in message <hojb69$qam$1(a)fred.mathworks.com>...
> "Edmund " <azuro20025(a)hotmail.com> wrote in message <hojalc$ie4$1(a)fred.mathworks.com>...
> > Hi,
> >
> > If I have a value of 22.223 and 1.342 , how can I get a result like 22 and 1 only?
> >
> > I need to eliminate the numbers behind the point and get a whole number instead.
> >
> > my implimentation is this:
> >
> > x=2250
> >
> > x1=x/1000
> >
> > x1 will have a value of 2.250, and I want to get a value of 2.000 instead.
> >
> > x2=x/100
> >
> > x2 will have a value of 22.50 and I want to get a value of 22.00 instead.
> >
> > Note: I am using Simulink function block so some functions may not work such as mxarray, print and other functions that may be used to solve this problem.
> >
> > Any help would be really appreciated :)
> >
> > Thanks
> > Regards
> > Edmund
>
> hmm...
>
> help fix;
> help floor;
>
> maybe(?)...
> us

Sorry didn't know about these two functions.

Thanks a lot us :).