フィルターのクリア

Get and set Simulink model data from Matlab?

2 ビュー (過去 30 日間)
Lucas
Lucas 2012 年 5 月 17 日
I have a simple model with 1 input and output. The input it directly linked to the output. I was wondering if there was any way I could get the input name, set a value to it, run it and see if the output matches the input. I want to try and do this from an .M file if possible. Thanks!

採用された回答

K E
K E 2012 年 5 月 17 日
Perhaps this explanation of the get_param and set_param commands will help. You could use get_param and set_param from within a mfile that uses the sim command to run the simulation. If your input and output are scalars, just take their difference in the mfile after the sim command. If they are time series,
isDifferent = sum(myInput - myOutput) ~= 0 ;
  3 件のコメント
K E
K E 2012 年 5 月 17 日
If you are doing this from inside a Matlab script, you could use the disp command (http://www.mathworks.com/help/techdoc/ref/disp.html) to display the value returned by get_param at the Matlab prompt. Or you could make a GUI to show it but I don't know the details.
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 18 日
Lucas: You can use the Inport/Outport blocks to import/export data using the "Data Import/Export" pane of the model's Configuraion Parameters window. See here for more explanation: http://www.mathworks.com/help/toolbox/simulink/ug/bsuwmmp.html

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by