From: jens on
Hey

If I use the round function to a vector of numbers I can round the elements to nearest integer.

Like:

>> round([1.2 1.7])

ans =

1 2


What if I want to round it to something like:

x=[42 53 47] >> [40 50 50]

Best Regards

Jens
From: John D'Errico on
"jens " <pascal(a)hotmail.com> wrote in message <ht0h9n$j3n$1(a)fred.mathworks.com>...
> Hey
>
> If I use the round function to a vector of numbers I can round the elements to nearest integer.
>
> Like:
>
> >> round([1.2 1.7])
>
> ans =
>
> 1 2
>
>
> What if I want to round it to something like:
>
> x=[42 53 47] >> [40 50 50]

What would happen if you divided the number by 10?

Could you use round then?

Could you then recover the effect of dividing by 10?

John
From: jens on
"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <ht0is8$1bo$1(a)fred.mathworks.com>...
> "jens " <pascal(a)hotmail.com> wrote in message <ht0h9n$j3n$1(a)fred.mathworks.com>...
> > Hey
> >
> > If I use the round function to a vector of numbers I can round the elements to nearest integer.
> >
> > Like:
> >
> > >> round([1.2 1.7])
> >
> > ans =
> >
> > 1 2
> >
> >
> > What if I want to round it to something like:
> >
> > x=[42 53 47] >> [40 50 50]
>
> What would happen if you divided the number by 10?
>
> Could you use round then?
>
> Could you then recover the effect of dividing by 10?
>
> John


Thank you very much John

This was also what I though was the easiest way. I just wanted to check if there was some build in function in matlab.

Best Regards

Jens
 | 
Pages: 1
Prev: Sampling rates in Simulink
Next: create a mask