Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help using "disp"
Date: Fri, 23 Jan 2009 09:30:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <glc2ms$pgd$1@fred.mathworks.com>
References: <glc2bi$3ee$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232703004 26125 172.30.248.37 (23 Jan 2009 09:30:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 23 Jan 2009 09:30:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1171274
Xref: news.mathworks.com comp.soft-sys.matlab:513351


"Daniel Eliasson" <danielel@kth.se> wrote in message <glc2bi$3ee$1@fred.mathworks.com>...
> Hello
> 
> I have done a calcualtion and I get this
> 
> ans=
> 
> 11.3
> 
> But I want it to say
> 
> The answer is: 11.3
> 
> How do I do that with the disp function?
> 
> Thanks

I come from a C background so I always do this


ans = 11.3;
fprintf('The answer is: %3.1f\n', ans);