필터 지우기
필터 지우기

Get and set Simulink model data from Matlab?

조회 수: 1 (최근 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 CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by