From: juliette Salexa on
When I apply the command: format short , my numbers only arrive as 5 digit strings.

When I apply the command:format long, my numbers arrive as massive 14 digit strings.

I want to be able to customize this. Ideally I should be able to do something like:

short=8 , and then: format short, would make my numbers have 8 digits instead of 5.

Is there a way to do this in matlab?

From: someone on
"juliette Salexa" <n_dattani(a)hotmail.com> wrote in message <gigvca$j7d$1(a)fred.mathworks.com>...
> When I apply the command: format short , my numbers only arrive as 5 digit strings.
>
> When I apply the command:format long, my numbers arrive as massive 14 digit strings.
>
> I want to be able to customize this. Ideally I should be able to do something like:
>
> short=8 , and then: format short, would make my numbers have 8 digits instead of 5.
>
> Is there a way to do this in matlab?

doc sprintf

From: juliette Salexa on
That response did NOT help me!!

"someone" <someone(a)somewhere.net> wrote in message <gih04i$7k1$1(a)fred.mathworks.com>...
> "juliette Salexa" <n_dattani(a)hotmail.com> wrote in message <gigvca$j7d$1(a)fred.mathworks.com>...
> > When I apply the command: format short , my numbers only arrive as 5 digit strings.
> >
> > When I apply the command:format long, my numbers arrive as massive 14 digit strings.
> >
> > I want to be able to customize this. Ideally I should be able to do something like:
> >
> > short=8 , and then: format short, would make my numbers have 8 digits instead of 5.
> >
> > Is there a way to do this in matlab?
>
> doc sprintf

From: Walter Roberson on
juliette Salexa wrote:
> When I apply the command: format short , my numbers only arrive as 5 digit strings.

> When I apply the command:format long, my numbers arrive as massive 14 digit strings.

> I want to be able to customize this. Ideally I should be able to do something like:

> short=8 , and then: format short, would make my numbers have 8 digits instead of 5.

> Is there a way to do this in matlab?


No, there is no way to do that in Matlab, as the premise is incorrect. The 'format'
command affects only the display of values via disp() or by default output
(no semi-colon after an expression), and in no way affects the number of digits
that "arrive", and in no way affects the number of digits that are saved in .mat
files or that are saved via save -ascii, and in no way affects csvwrite() or
dlmwrite().

If your request is to change the format used by disp() or by default output,
to something not already supported by the 'format' command, then NO, there is
no way to do that.


> That response did NOT help me!!

That response did not help -us- to know what was not acceptable about using sprintf()
in your situation.

--
..signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?
From: Doug Schwarz on
In article <lOV2l.59509$yB4.51551(a)newsfe07.iad>,
Walter Roberson <roberson(a)hushmail.com> wrote:

> If your request is to change the format used by disp() or by default output,
> to something not already supported by the 'format' command, then NO, there is
> no way to do that.

Well, that's not quite true -- you can overload disp and display to do
whatever you want.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.