MATLAB Answers

interfacing with exe from matlab

1 ビュー (過去 30 日間)
Amardeep
Amardeep 2011 年 11 月 23 日
Hi Everbody;
I am running a Simulink compiled .exe model from my Matlab and it doesnt seem to be picking up the data from .mat files.
When I made the simulink it had 'from file' blocks pointing to .mat files. These should then be loaded in for each execution of the compiled exe. Before each execution the inputs for the exe are changed dependant on the previous output (and thus cannot be time logged as it isn't possible to know what the next sets of inputs will be depending on the current).
How is it I can get the exe to load the .mat data on each execution (would changing to ASCII txt files work?)
Regards
Amardeep

  0 件のコメント

サインインしてコメントする。

採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 11 月 24 日
Hi Amardeep,
I recommend changing the code generation target from GRT to "Rapid Simulation Target": this already comes with command line parameters (e.g. for replacing From File block filenames), but most important it really reads the file for the simulation.
Titus

  3 件のコメント

Amardeep
Amardeep 2011 年 11 月 24 日
Many apologies for being useless at this but where is that option? I cant find it in the configuration parameters =S
Titus Edelhofer
Titus Edelhofer 2011 年 11 月 24 日
It is on the code generation page (Real-Time Workshop or Simulink Coder). On the configuration parameters probably the last entry in the tree.
Amardeep
Amardeep 2011 年 11 月 24 日
Fantastic ... I didnt see it in the browse options ... Doh!
Thanks for your help.
Amardeep

サインインしてコメントする。

その他の回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2011 年 11 月 23 日
You may need to modify the code generated for the executable so that you can use a command-line argument (or some similar idea) to specify the MAT-file name. I would recommend inspecting the generated code to find the variable where the file-name is assigned and convert that into a command-line argument.

  1 件のコメント

Amardeep
Amardeep 2011 年 11 月 24 日
I have found the point in the code where it calls in the file values but it doesnt use the file name at all. I believe the compiler has simply called in the values which were in the .mat files at the time of code generation.
Under void MdlStart(void) there is a number of sections (one for each mat file being loaded) which have:
{
static const real_T tuData [5] = { the 5 data points };
Function_Dwork.FromFile_PWORK-n.PrevTimePtr =(void *) &tuData [0];
}
How would I ammend this to dynamically load data on each execution?
Thanks

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by