Path: news.mathworks.com!not-for-mail
From: "ade77 " <ade100a@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: M-File - How to input ?
Date: Tue, 3 Nov 2009 20:06:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 53
Message-ID: <hcq2fa$slt$1@fred.mathworks.com>
References: <hcprre$sfp$1@fred.mathworks.com> <hcpsg2$aqj$1@fred.mathworks.com> <hcq066$535$1@fred.mathworks.com>
Reply-To: "ade77 " <ade100a@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257278762 29373 172.30.248.35 (3 Nov 2009 20:06:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Nov 2009 20:06:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1059495
Xref: news.mathworks.com comp.soft-sys.matlab:582152


Sebastine  already gave you that answer.

g = input('enter the value of g');
b = input('enter the value of b');
a = input('enter the value of a');
tol= input('enter the value of tol');

you can change the string quote to your satisfaction.

"Ahmad " <climber65@gmail.com> wrote in message <hcq066$535$1@fred.mathworks.com>...
> "ade77 " <ade100a@gmail.com> wrote in message <hcpsg2$aqj$1@fred.mathworks.com>...
> > use inputdlg
> > for example;
> > g = inputdlg('enter the value of g'), will display a dialog box, where the user can enter the value of g.
> > type doc inputdlg at the command prompt to get more options on this function
> > 
> > "Ahmad " <climber65@gmail.com> wrote in message <hcprre$sfp$1@fred.mathworks.com>...
> > > If I want to input a function without a gui then how can I do it so that the M-file is a exe and still asks user for input and executes code line-by-line and then asks for input in whichever line it is required?
> > > 
> > > In the following I want to input g,a,b, and tol from user. How can I get this done?
> > > 
> > > syms x
> > > g=?
> > > dg=diff(g,x);
> > > f=sym2poly(g);
> > > df=sym2poly(dg);
> > > 
> > > a=?
> > > b=?
> > > tol=?
> > > itr=2;
> > > itrr=50;
> > > 
> > > for i=1:itr
> > > p=(a+b)/2;
> > > if(polyval(f,a)*polyval(f,p)<0)
> > > b=p;
> > > else
> > > a=p;
> > > end
> > > end
> > > s=p;
> > > 
> > > for j=1:itrr
> > > s1=s-polyval(f,s)/polyval(df,s)
> > > if(polyval(f,s)==0|[abs(s-s1)/s]<tol)
> > > break
> > > else
> > > s=s1
> > > end
> > > end
> 
> thx