Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: standalone program with changed input for Simulink.. How?
Date: Sun, 15 Nov 2009 20:05:03 +0000 (UTC)
Organization: KAU
Lines: 65
Message-ID: <hdpmtf$d3s$1@fred.mathworks.com>
References: <hdms6t$2il$1@fred.mathworks.com> <87pr7j3o3k.fsf@echo.mueller-schleicher.i>
Reply-To: <HIDDEN>
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 1258315503 13436 172.30.248.35 (15 Nov 2009 20:05:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 15 Nov 2009 20:05:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2092387
Xref: news.mathworks.com comp.soft-sys.matlab:585282


Ralph Schleicher <rs@ralph-schleicher.de> wrote in message <87pr7j3o3k.fsf@echo.mueller-schleicher.i>...
> "Bilal AbdulAll" <b.prodev@gmail.com> writes:
> 
> > 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?
> 
> Read more about the Rsim target in the RTW manual.
> 
> > So, how to do that as a standalone program?
> 
> Do it programmatically. For example,
> 
> MATFile *f;
> mxArray *rtP, *a;
> 
> f = matOpen ("default.mat", "r");
> if (f == NULL)
>   exit (1);
> 
> rtP = matGetArray (f, "rtP");
> if (rtP == NULL)
>   exit (1);
> 
> if (matClose (f) == EOF)
>   exit (1);
> 
> a = mxCreateDoubleMatrix (1, 1, mxREAL);
> if (a == NULL)
>   exit (1);
> 
> v = mxGetPr (a);
> v[0] = 2.0;
> 
> mxSetField (rtP, 1, "value", a);
> 
> f = matOpen ("param.mat", "w");
> if (f == NULL)
>   exit (1);
> 
> if (matPutArray (f, rtP) != 0)
>   exit (1);
> 
> if (matClose (f) == EOF)
>   exit (1);
> 
> /* Now call rsim executable with 'param.mat' as parameter file.  */
> 
> -- 
> Ralph Schleicher  <http://ralph-schleicher.de>
> 
> Development * Consulting * Training
> Mathematical Modeling and Simulation
> Software Tools

thank you for ur effort Mr. Ralph, but actually i'm not good in C language...

here are the 'envi14.m' file that envokes 'simstart.m' file that starts the simulink ..
http://www.4shared.com/file/152744307/e72481cb/envi14.html
http://www.4shared.com/file/152744812/8200abe4/simstart.html

would u plz tell me with some details how to do it ?

thank you in advance