Thread Subject: change the form of the ans prompt?

Subject: change the form of the ans prompt?

From: Uwe Brauer

Date: 27 Jan, 2012 19:00:10

Message: 1 of 6

Hello

when I type
>> x=5

the matlab prompt gives me

x=

      5

I find this very disturbing.

I would much prefer to have

x=5

all in the same line! is there any variable which I could use to obtain the setting I want?

thanks
Uwe Brauer

Subject: change the form of the ans prompt?

From: dpb

Date: 27 Jan, 2012 19:13:15

Message: 2 of 6

On 1/27/2012 1:00 PM, Uwe Brauer wrote:
...

> I would much prefer to have
>
> x=5
>
> all in the same line! is there any variable which I could use to obtain
> the setting I want?
...

doc format

If Matlab doesn't remember in new session, put the form you want in
startup.m

--

Subject: change the form of the ans prompt?

From: Doug Schwarz

Date: 27 Jan, 2012 19:16:43

Message: 3 of 6

On 1/27/2012 2:00 PM, Uwe Brauer wrote:
> Hello
>
> when I type
>>> x=5
>
> the matlab prompt gives me
>
> x=
>
> 5
>
> I find this very disturbing.
>
> I would much prefer to have
>
> x=5
>
> all in the same line! is there any variable which I could use to obtain
> the setting I want?
>
> thanks
> Uwe Brauer

Uwe,

You can overload the display method for the double class and make it do
anything you want. To do this, create a directory "@double" and put it
inside a directory that is on your path (do not put @double on the
path). Then create display.m inside @double. In display.m you can
define any behavior you want, but beware! It's trickier than you might
think to get this right. You have to handle scalars and matrices of any
size. Good luck.



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

Subject: change the form of the ans prompt?

From: Uwe Brauer

Date: 27 Jan, 2012 19:38:10

Message: 4 of 6

dpb <none@non.net> wrote in message <jfut07$11c$2@speranza.aioe.org>...
> On 1/27/2012 1:00 PM, Uwe Brauer wrote:
> ...
>
> > I would much prefer to have
> >
> > x=5
> >
> > all in the same line! is there any variable which I could use to obtain
> > the setting I want?
> ...
>
> doc format
>
> If Matlab doesn't remember in new session, put the form you want in
> startup.m
>
> --
yes I know about format. And I have looked it up a dozen of times, but
where to I set it up as I desribed above?

Subject: change the form of the ans prompt?

From: Uwe Brauer

Date: 27 Jan, 2012 19:41:09

Message: 5 of 6

Doug Schwarz <see@sig.for.address.edu> wrote in message <uKCUq.1620$1B1.487@newsfe14.iad>...
> On 1/27/2012 2:00 PM, Uwe Brauer wrote:
> > Hello
> >
> > when I type
> >>> x=5
> >
> > the matlab prompt gives me
> >
> > x=
> >
> > 5
> >
> > I find this very disturbing.
> >
> > I would much prefer to have
> >
> > x=5
> >
> > all in the same line! is there any variable which I could use to obtain
> > the setting I want?
> >
> > thanks
> > Uwe Brauer
>
> Uwe,
>
> You can overload the display method for the double class and make it do
> anything you want. To do this, create a directory "@double" and put it
> inside a directory that is on your path (do not put @double on the
> path). Then create display.m inside @double. In display.m you can
> define any behavior you want, but beware! It's trickier than you might
> think to get this right. You have to handle scalars and matrices of any
> size. Good luck.
>
>
>
Doug
Thanks for the instructions. I just searched in my matlab directories, display.m and it seems that each toolbox has its own display.m.

What is the best one to start?

I basically use Matlab ode functions, or write up my own ode alg.

Uwe

Subject: change the form of the ans prompt?

From: Doug Schwarz

Date: 27 Jan, 2012 20:39:01

Message: 6 of 6

On 1/27/2012 2:41 PM, Uwe Brauer wrote:
> Doug Schwarz <see@sig.for.address.edu> wrote in message
> <uKCUq.1620$1B1.487@newsfe14.iad>...
>> On 1/27/2012 2:00 PM, Uwe Brauer wrote:
>> > Hello
>> >
>> > when I type
>> >>> x=5
>> >
>> > the matlab prompt gives me
>> >
>> > x=
>> >
>> > 5
>> >
>> > I find this very disturbing.
>> >
>> > I would much prefer to have
>> >
>> > x=5
>> >
>> > all in the same line! is there any variable which I could use to obtain
>> > the setting I want?
>> >
>> > thanks
>> > Uwe Brauer
>>
>> Uwe,
>>
>> You can overload the display method for the double class and make it
>> do anything you want. To do this, create a directory "@double" and put
>> it inside a directory that is on your path (do not put @double on the
>> path). Then create display.m inside @double. In display.m you can
>> define any behavior you want, but beware! It's trickier than you might
>> think to get this right. You have to handle scalars and matrices of
>> any size. Good luck.
>>
>>
>>
> Doug
> Thanks for the instructions. I just searched in my matlab directories,
> display.m and it seems that each toolbox has its own display.m.
>
> What is the best one to start?
>
> I basically use Matlab ode functions, or write up my own ode alg.
>
> Uwe

You don't want to use one of the existing display.m functions, you need
to create a new one for the double class. The default display used by
double is built-in, but this new file (@double/display.m) will be called
once it exists. You might want to write it so a simple scalar is
displayed the way you wrote, but anything larger gets passed to the
built-in version (using the "builtin" function).



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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
prompt Uwe Brauer 27 Jan, 2012 14:04:16
rssFeed for this Thread

Contact us at files@mathworks.com