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

Thread Subject:
format the values in array

Subject: format the values in array

From: Reza Reza

Date: 2 Nov, 2010 16:39:04

Message: 1 of 4

Hi,

I put the following number in an array A:
624.1249 1070

but the output will be sth like:
 0.6241 1.0700

why ? and what should I do?
thanks in advance

Subject: format the values in array

From: Sean

Date: 2 Nov, 2010 16:48:04

Message: 2 of 4

"Reza Reza" <persianfriend12@yahoo.com> wrote in message <iaper8$fq6$1@fred.mathworks.com>...
> Hi,
>
> I put the following number in an array A:
> 624.1249 1070
>
> but the output will be sth like:
> 0.6241 1.0700
>
> why ? and what should I do?
> thanks in advance

doc format
doc fprintf

Subject: format the values in array

From: Reza Reza

Date: 2 Nov, 2010 16:56:04

Message: 3 of 4

what do u mean?

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <iapfc4$kvn$1@fred.mathworks.com>...
> "Reza Reza" <persianfriend12@yahoo.com> wrote in message <iaper8$fq6$1@fred.mathworks.com>...
> > Hi,
> >
> > I put the following number in an array A:
> > 624.1249 1070
> >
> > but the output will be sth like:
> > 0.6241 1.0700
> >
> > why ? and what should I do?
> > thanks in advance
>
> doc format
> doc fprintf

Subject: format the values in array

From: Oleg Komarov

Date: 2 Nov, 2010 17:03:04

Message: 4 of 4

"Reza Reza" <persianfriend12@yahoo.com> wrote in message <iapfr4$lus$1@fred.mathworks.com>...
> what do u mean?
>
> "Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <iapfc4$kvn$1@fred.mathworks.com>...
> > "Reza Reza" <persianfriend12@yahoo.com> wrote in message <iaper8$fq6$1@fred.mathworks.com>...
> > > Hi,
> > >
> > > I put the following number in an array A:
> > > 624.1249 1070
> > >
> > > but the output will be sth like:
> > > 0.6241 1.0700
> > >
> > > why ? and what should I do?
> > > thanks in advance
> >
> > doc format
> > doc fprintf

1) Please don't top post
2) doc format or doc sprintf/fprintf means that typing those commands in the command window opens the documentation related to those fuctions. Said that, format and fprintf have the answer to your question.
3) The answer to your question is that the value you SEE is formatted in that way but is the same as the value you HAVE (given).

Oleg

Tags for 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