How to import matlab file variables in Simulink (By adding some block in Simulink Model)

1 view (last 30 days)
I have seen in some Simulink Model, there was a block with the M-File. You just double click that file, it gets executed and variables are available for Simulink Model. Can anybody help me to find the way to do it. Thanks

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 27 Oct 2011
That is probably a customized mask of a subsystem block. Assume the M-file you want to run is MyParam.m, you can drag an empty subsystem block, right click, select 'block properties', select 'Callbacks' tab, select 'OpenFcn', type in MyParam.
You can even mask it by select the block, press ctrl+M, in the 'Drawing Commands', put in disp('MyParam').

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!