From: Jerry Walker on
I would like to format my output to appears as:

ZL = 345

rather than

ZL =
345

If possible, I would appreciate assistance
From: Walter Roberson on
Jerry Walker wrote:
> I would like to format my output to appears as:
>
> ZL = 345
> rather than
>
> ZL =
> 345


disp(sprintf('ZL = %d\n', ZL));

Or, more obscurely but still correct:

fprintf('ZL = %d\n', ZL);


If ZL is a vector,

fprintf('ZL = %s\n', num2str(ZL(:).'));
From: Jerry Walker on
Walter Roberson <roberson(a)hushmail.com> wrote in message <ho41d1$p62$1(a)canopus.cc.umanitoba.ca>...
> Jerry Walker wrote:
> > I would like to format my output to appears as:
> >
> > ZL = 345
> > rather than
> >
> > ZL =
> > 345
>
>
> disp(sprintf('ZL = %d\n', ZL));
>
> Or, more obscurely but still correct:
>
> fprintf('ZL = %d\n', ZL);
>
>
> If ZL is a vector,
>
> fprintf('ZL = %s\n', num2str(ZL(:).'));

Is there a command to format the output globally so that I can get a product that looks as:
A=1
B=2
C=3
and so forth?
From: Walter Roberson on
Jerry Walker wrote:

> Is there a command to format the output globally so that I can get a
> product that looks as:
> A=1
> B=2
> C=3 and so forth?

No.

Though possibly you might be able to get somewhere by writing your own
function named 'display' and having it on the front of your path. (Try
having your own 'disp' as well.)
From: Doug Schwarz on
In article <ho5o9v$ml6$1(a)canopus.cc.umanitoba.ca>,
Walter Roberson <roberson(a)hushmail.com> wrote:

> Jerry Walker wrote:
>
> > Is there a command to format the output globally so that I can get a
> > product that looks as:
> > A=1
> > B=2
> > C=3 and so forth?
>
> No.
>
> Though possibly you might be able to get somewhere by writing your own
> function named 'display' and having it on the front of your path. (Try
> having your own 'disp' as well.)


display is a built-in function so you would need to overload it to get
it to run and that is, indeed, the way to get what you want.

To overload display, create display.m and put it in a directory called
@double which is itself inside a directory on the MATLAB path. (Do not
put @double on the path.)

You can program display.m to do anything you want, including call the
built-in display (with builtin('display'...) ), if desired. You will
need a separate version of display.m for each data type for which you
want a custom display method.

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