<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860</link>
    <title>MATLAB Central Newsreader - M-File - How to input ?</title>
    <description>Feed for thread: M-File - How to input ?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 03 Nov 2009 18:13:02 -0500</pubDate>
      <title>M-File - How to input ?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860#691787</link>
      <author>Ahmad </author>
      <description>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?&lt;br&gt;
&lt;br&gt;
In the following I want to input g,a,b, and tol from user. How can I get this done?&lt;br&gt;
&lt;br&gt;
syms x&lt;br&gt;
g=?&lt;br&gt;
dg=diff(g,x);&lt;br&gt;
f=sym2poly(g);&lt;br&gt;
df=sym2poly(dg);&lt;br&gt;
&lt;br&gt;
a=?&lt;br&gt;
b=?&lt;br&gt;
tol=?&lt;br&gt;
itr=2;&lt;br&gt;
itrr=50;&lt;br&gt;
&lt;br&gt;
for i=1:itr&lt;br&gt;
p=(a+b)/2;&lt;br&gt;
if(polyval(f,a)*polyval(f,p)&amp;lt;0)&lt;br&gt;
b=p;&lt;br&gt;
else&lt;br&gt;
a=p;&lt;br&gt;
end&lt;br&gt;
end&lt;br&gt;
s=p;&lt;br&gt;
&lt;br&gt;
for j=1:itrr&lt;br&gt;
s1=s-polyval(f,s)/polyval(df,s)&lt;br&gt;
if(polyval(f,s)==0|[abs(s-s1)/s]&amp;lt;tol)&lt;br&gt;
break&lt;br&gt;
else&lt;br&gt;
s=s1&lt;br&gt;
end&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 18:24:02 -0500</pubDate>
      <title>Re: M-File - How to input ?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860#691791</link>
      <author>ade77 </author>
      <description>use inputdlg&lt;br&gt;
for example;&lt;br&gt;
g = inputdlg('enter the value of g'), will display a dialog box, where the user can enter the value of g.&lt;br&gt;
type doc inputdlg at the command prompt to get more options on this function&lt;br&gt;
&lt;br&gt;
&quot;Ahmad &quot; &amp;lt;climber65@gmail.com&amp;gt; wrote in message &amp;lt;hcprre$sfp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; 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?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In the following I want to input g,a,b, and tol from user. How can I get this done?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; syms x&lt;br&gt;
&amp;gt; g=?&lt;br&gt;
&amp;gt; dg=diff(g,x);&lt;br&gt;
&amp;gt; f=sym2poly(g);&lt;br&gt;
&amp;gt; df=sym2poly(dg);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; a=?&lt;br&gt;
&amp;gt; b=?&lt;br&gt;
&amp;gt; tol=?&lt;br&gt;
&amp;gt; itr=2;&lt;br&gt;
&amp;gt; itrr=50;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for i=1:itr&lt;br&gt;
&amp;gt; p=(a+b)/2;&lt;br&gt;
&amp;gt; if(polyval(f,a)*polyval(f,p)&amp;lt;0)&lt;br&gt;
&amp;gt; b=p;&lt;br&gt;
&amp;gt; else&lt;br&gt;
&amp;gt; a=p;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; s=p;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for j=1:itrr&lt;br&gt;
&amp;gt; s1=s-polyval(f,s)/polyval(df,s)&lt;br&gt;
&amp;gt; if(polyval(f,s)==0|[abs(s-s1)/s]&amp;lt;tol)&lt;br&gt;
&amp;gt; break&lt;br&gt;
&amp;gt; else&lt;br&gt;
&amp;gt; s=s1&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; end</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 18:29:05 -0500</pubDate>
      <title>Re: M-File - How to input ?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860#691792</link>
      <author>Sebastiaan </author>
      <description>&quot;Ahmad &quot; &amp;lt;climber65@gmail.com&amp;gt; wrote in message &amp;lt;hcprre$sfp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; 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?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In the following I want to input g,a,b, and tol from user. How can I get this done?&lt;br&gt;
&amp;gt; &lt;br&gt;
help input&lt;br&gt;
&lt;br&gt;
Sebastiaan</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 19:27:02 -0500</pubDate>
      <title>Re: M-File - How to input ?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860#691812</link>
      <author>Ahmad </author>
      <description>&quot;ade77 &quot; &amp;lt;ade100a@gmail.com&amp;gt; wrote in message &amp;lt;hcpsg2$aqj$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; use inputdlg&lt;br&gt;
&amp;gt; for example;&lt;br&gt;
&amp;gt; g = inputdlg('enter the value of g'), will display a dialog box, where the user can enter the value of g.&lt;br&gt;
&amp;gt; type doc inputdlg at the command prompt to get more options on this function&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Ahmad &quot; &amp;lt;climber65@gmail.com&amp;gt; wrote in message &amp;lt;hcprre$sfp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; 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?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; In the following I want to input g,a,b, and tol from user. How can I get this done?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; syms x&lt;br&gt;
&amp;gt; &amp;gt; g=?&lt;br&gt;
&amp;gt; &amp;gt; dg=diff(g,x);&lt;br&gt;
&amp;gt; &amp;gt; f=sym2poly(g);&lt;br&gt;
&amp;gt; &amp;gt; df=sym2poly(dg);&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; a=?&lt;br&gt;
&amp;gt; &amp;gt; b=?&lt;br&gt;
&amp;gt; &amp;gt; tol=?&lt;br&gt;
&amp;gt; &amp;gt; itr=2;&lt;br&gt;
&amp;gt; &amp;gt; itrr=50;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; for i=1:itr&lt;br&gt;
&amp;gt; &amp;gt; p=(a+b)/2;&lt;br&gt;
&amp;gt; &amp;gt; if(polyval(f,a)*polyval(f,p)&amp;lt;0)&lt;br&gt;
&amp;gt; &amp;gt; b=p;&lt;br&gt;
&amp;gt; &amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt; a=p;&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; s=p;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; for j=1:itrr&lt;br&gt;
&amp;gt; &amp;gt; s1=s-polyval(f,s)/polyval(df,s)&lt;br&gt;
&amp;gt; &amp;gt; if(polyval(f,s)==0|[abs(s-s1)/s]&amp;lt;tol)&lt;br&gt;
&amp;gt; &amp;gt; break&lt;br&gt;
&amp;gt; &amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt; s=s1&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&lt;br&gt;
thx</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 20:06:02 -0500</pubDate>
      <title>Re: M-File - How to input ?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264860#691822</link>
      <author>ade77 </author>
      <description>Sebastine  already gave you that answer.&lt;br&gt;
&lt;br&gt;
g = input('enter the value of g');&lt;br&gt;
b = input('enter the value of b');&lt;br&gt;
a = input('enter the value of a');&lt;br&gt;
tol= input('enter the value of tol');&lt;br&gt;
&lt;br&gt;
you can change the string quote to your satisfaction.&lt;br&gt;
&lt;br&gt;
&quot;Ahmad &quot; &amp;lt;climber65@gmail.com&amp;gt; wrote in message &amp;lt;hcq066$535$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;ade77 &quot; &amp;lt;ade100a@gmail.com&amp;gt; wrote in message &amp;lt;hcpsg2$aqj$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; use inputdlg&lt;br&gt;
&amp;gt; &amp;gt; for example;&lt;br&gt;
&amp;gt; &amp;gt; g = inputdlg('enter the value of g'), will display a dialog box, where the user can enter the value of g.&lt;br&gt;
&amp;gt; &amp;gt; type doc inputdlg at the command prompt to get more options on this function&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &quot;Ahmad &quot; &amp;lt;climber65@gmail.com&amp;gt; wrote in message &amp;lt;hcprre$sfp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 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?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; In the following I want to input g,a,b, and tol from user. How can I get this done?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; syms x&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; g=?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; dg=diff(g,x);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; f=sym2poly(g);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; df=sym2poly(dg);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; a=?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; b=?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; tol=?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; itr=2;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; itrr=50;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; for i=1:itr&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; p=(a+b)/2;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if(polyval(f,a)*polyval(f,p)&amp;lt;0)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; b=p;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; a=p;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; s=p;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; for j=1:itrr&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; s1=s-polyval(f,s)/polyval(df,s)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if(polyval(f,s)==0|[abs(s-s1)/s]&amp;lt;tol)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; break&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; s=s1&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thx</description>
    </item>
  </channel>
</rss>

