Call a Simulink simulation from shell

1 回表示 (過去 30 日間)
Nikhil Jones
Nikhil Jones 2014 年 12 月 23 日
コメント済み: Nikhil Jones 2014 年 12 月 24 日
Hi Guys,
I have a Simulink simulation with me. It simply reads two time series objects from 2 files, multiplies it by a constant and returns 2 time series objects too.
I need to call the Simulink simulation from the shell, provide it with the path of the files from where it needs to read the input and provide the path of the folder to where it needs to write the output.
How do i go about this? I have never used MATLAB or Simulink before. I only need to integrate the already existing simulations with a scheduler that refreshes the input files periodically.
Thanks.

採用された回答

A Jenkins
A Jenkins 2014 年 12 月 23 日
編集済み: A Jenkins 2014 年 12 月 23 日
Step 1) Write your function in MATLAB that takes your file names and runs your simulation. It would look something like this:
function my_fcn(inputdata,outputdata)
load(inputdata)
sim('my_model.slx')
save(outputdata)
exit()
end
Step 2) Call your function from the command line, with the appropriate arguments. This works for windows, but I believe something similar exists for Unix. Just type matlab -h to learn more.
matlab -nodesktop -nosplash -r my_fcn('inputfile.mat','outputfile.mat')
  1 件のコメント
Nikhil Jones
Nikhil Jones 2014 年 12 月 24 日
Great. Thank you very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by