<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865</link>
    <title>MATLAB Central Newsreader - standalone program with changed input for Simulink.. How?</title>
    <description>Feed for thread: standalone program with changed input for Simulink.. How?</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>Sat, 14 Nov 2009 18:17:01 -0500</pubDate>
      <title>standalone program with changed input for Simulink.. How?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865#694780</link>
      <author>Bilal AbdulAll</author>
      <description>Hi,&lt;br&gt;
I've checked many threads here talking about making a standalone .exe Simulink model and evoking it from the standalone .exe program, but i couldn't find any talked about the my following issue:&lt;br&gt;
&lt;br&gt;
My program takes input from the user and starts the Simulink Model using these inputs (inputs changes by user almost every time) then the output from the Simulink model decides wither the program continue or not!&lt;br&gt;
&lt;br&gt;
what i know is i have to use 'rtwbuild()' to have an .exe version of the Simulink model, but the main issue here is how to send these inputs every time to the Simulink from the main standalone program and taking the output in the Main standalone program?&lt;br&gt;
&lt;br&gt;
So, how to do that as a standalone program?&lt;br&gt;
&lt;br&gt;
Code that starts the Simulink:&lt;br&gt;
&lt;br&gt;
global DSSv;&lt;br&gt;
options = simset('SrcWorkspace', 'parent');&lt;br&gt;
sim('DSS.mdl',[], options);&lt;br&gt;
DSSv.DMC = DMC(1);&lt;br&gt;
&lt;br&gt;
thanks in advance..</description>
    </item>
    <item>
      <pubDate>Sun, 15 Nov 2009 13:38:07 -0500</pubDate>
      <title>Re: standalone program with changed input for Simulink.. How?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865#694878</link>
      <author>Ralph Schleicher</author>
      <description>&quot;Bilal AbdulAll&quot; &amp;lt;b.prodev@gmail.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; what i know is i have to use 'rtwbuild()' to have an .exe version of&lt;br&gt;
&amp;gt; the Simulink model, but the main issue here is how to send these&lt;br&gt;
&amp;gt; inputs every time to the Simulink from the main standalone program and&lt;br&gt;
&amp;gt; taking the output in the Main standalone program?&lt;br&gt;
&lt;br&gt;
Read more about the Rsim target in the RTW manual.&lt;br&gt;
&lt;br&gt;
&amp;gt; So, how to do that as a standalone program?&lt;br&gt;
&lt;br&gt;
Do it programmatically. For example,&lt;br&gt;
&lt;br&gt;
MATFile *f;&lt;br&gt;
mxArray *rtP, *a;&lt;br&gt;
&lt;br&gt;
f = matOpen (&quot;default.mat&quot;, &quot;r&quot;);&lt;br&gt;
if (f == NULL)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
rtP = matGetArray (f, &quot;rtP&quot;);&lt;br&gt;
if (rtP == NULL)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
if (matClose (f) == EOF)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
a = mxCreateDoubleMatrix (1, 1, mxREAL);&lt;br&gt;
if (a == NULL)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
v = mxGetPr (a);&lt;br&gt;
v[0] = 2.0;&lt;br&gt;
&lt;br&gt;
mxSetField (rtP, 1, &quot;value&quot;, a);&lt;br&gt;
&lt;br&gt;
f = matOpen (&quot;param.mat&quot;, &quot;w&quot;);&lt;br&gt;
if (f == NULL)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
if (matPutArray (f, rtP) != 0)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
if (matClose (f) == EOF)&lt;br&gt;
&amp;nbsp;&amp;nbsp;exit (1);&lt;br&gt;
&lt;br&gt;
/* Now call rsim executable with 'param.mat' as parameter file.  */&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Ralph Schleicher  &amp;lt;&lt;a href=&quot;http://ralph-schleicher.de&quot;&gt;http://ralph-schleicher.de&lt;/a&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
Development * Consulting * Training&lt;br&gt;
Mathematical Modeling and Simulation&lt;br&gt;
Software Tools</description>
    </item>
    <item>
      <pubDate>Sun, 15 Nov 2009 20:05:03 -0500</pubDate>
      <title>Re: standalone program with changed input for Simulink.. How?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865#694935</link>
      <author>Bilal AbdulAll</author>
      <description>Ralph Schleicher &amp;lt;rs@ralph-schleicher.de&amp;gt; wrote in message &amp;lt;87pr7j3o3k.fsf@echo.mueller-schleicher.i&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Bilal AbdulAll&quot; &amp;lt;b.prodev@gmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; what i know is i have to use 'rtwbuild()' to have an .exe version of&lt;br&gt;
&amp;gt; &amp;gt; the Simulink model, but the main issue here is how to send these&lt;br&gt;
&amp;gt; &amp;gt; inputs every time to the Simulink from the main standalone program and&lt;br&gt;
&amp;gt; &amp;gt; taking the output in the Main standalone program?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Read more about the Rsim target in the RTW manual.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; So, how to do that as a standalone program?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Do it programmatically. For example,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; MATFile *f;&lt;br&gt;
&amp;gt; mxArray *rtP, *a;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; f = matOpen (&quot;default.mat&quot;, &quot;r&quot;);&lt;br&gt;
&amp;gt; if (f == NULL)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; rtP = matGetArray (f, &quot;rtP&quot;);&lt;br&gt;
&amp;gt; if (rtP == NULL)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if (matClose (f) == EOF)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; a = mxCreateDoubleMatrix (1, 1, mxREAL);&lt;br&gt;
&amp;gt; if (a == NULL)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; v = mxGetPr (a);&lt;br&gt;
&amp;gt; v[0] = 2.0;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; mxSetField (rtP, 1, &quot;value&quot;, a);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; f = matOpen (&quot;param.mat&quot;, &quot;w&quot;);&lt;br&gt;
&amp;gt; if (f == NULL)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if (matPutArray (f, rtP) != 0)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if (matClose (f) == EOF)&lt;br&gt;
&amp;gt;   exit (1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; /* Now call rsim executable with 'param.mat' as parameter file.  */&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Ralph Schleicher  &amp;lt;&lt;a href=&quot;http://ralph-schleicher.de&quot;&gt;http://ralph-schleicher.de&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Development * Consulting * Training&lt;br&gt;
&amp;gt; Mathematical Modeling and Simulation&lt;br&gt;
&amp;gt; Software Tools&lt;br&gt;
&lt;br&gt;
thank you for ur effort Mr. Ralph, but actually i'm not good in C language...&lt;br&gt;
&lt;br&gt;
here are the 'envi14.m' file that envokes 'simstart.m' file that starts the simulink ..&lt;br&gt;
&lt;a href=&quot;http://www.4shared.com/file/152744307/e72481cb/envi14.html&quot;&gt;http://www.4shared.com/file/152744307/e72481cb/envi14.html&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.4shared.com/file/152744812/8200abe4/simstart.html&quot;&gt;http://www.4shared.com/file/152744812/8200abe4/simstart.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
would u plz tell me with some details how to do it ?&lt;br&gt;
&lt;br&gt;
thank you in advance</description>
    </item>
    <item>
      <pubDate>Sun, 15 Nov 2009 20:53:00 -0500</pubDate>
      <title>Re: standalone program with changed input for Simulink.. How?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865#694943</link>
      <author>Ralph Schleicher</author>
      <description>&quot;Bilal AbdulAll&quot; &amp;lt;b.prodev@gmail.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; thank you for ur effort Mr. Ralph, but actually i'm not good in C language...&lt;br&gt;
&lt;br&gt;
So it's the right time to learn it.&lt;br&gt;
&lt;br&gt;
&amp;gt; here are the 'envi14.m' file that envokes 'simstart.m' file that starts the simulink ..&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.4shared.com/file/152744307/e72481cb/envi14.html&quot;&gt;http://www.4shared.com/file/152744307/e72481cb/envi14.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.4shared.com/file/152744812/8200abe4/simstart.html&quot;&gt;http://www.4shared.com/file/152744812/8200abe4/simstart.html&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; would u plz tell me with some details how to do it ?&lt;br&gt;
&lt;br&gt;
No.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Ralph Schleicher  &amp;lt;&lt;a href=&quot;http://ralph-schleicher.de&quot;&gt;http://ralph-schleicher.de&lt;/a&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
Development * Consulting * Training&lt;br&gt;
Mathematical Modeling and Simulation&lt;br&gt;
Software Tools</description>
    </item>
    <item>
      <pubDate>Mon, 16 Nov 2009 04:54:02 -0500</pubDate>
      <title>Re: standalone program with changed input for Simulink.. How?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265865#694975</link>
      <author>Bilal AbdulAll</author>
      <description>Ralph Schleicher &amp;lt;rs@ralph-schleicher.de&amp;gt; wrote in message &amp;lt;87lji733yr.fsf@echo.mueller-schleicher.i&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Bilal AbdulAll&quot; &amp;lt;b.prodev@gmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; thank you for ur effort Mr. Ralph, but actually i'm not good in C language...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So it's the right time to learn it.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; here are the 'envi14.m' file that envokes 'simstart.m' file that starts the simulink ..&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.4shared.com/file/152744307/e72481cb/envi14.html&quot;&gt;http://www.4shared.com/file/152744307/e72481cb/envi14.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.4shared.com/file/152744812/8200abe4/simstart.html&quot;&gt;http://www.4shared.com/file/152744812/8200abe4/simstart.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; would u plz tell me with some details how to do it ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; No.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Ralph Schleicher  &amp;lt;&lt;a href=&quot;http://ralph-schleicher.de&quot;&gt;http://ralph-schleicher.de&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Development * Consulting * Training&lt;br&gt;
&amp;gt; Mathematical Modeling and Simulation&lt;br&gt;
&amp;gt; Software Tools&lt;br&gt;
&lt;br&gt;
Thank You</description>
    </item>
  </channel>
</rss>

