Transfer of Fcn Block between Simulink and MATLAB
Show older comments
Hi, everyone. Before simulation I need to transmit to my Simulink model each time different function which is located in Fcn block. Of course I can pass variables to Fcn block but it is not sufficient. Thanks for your help.
Accepted Answer
More Answers (1)
Rostyk Spolyak
on 19 Oct 2011
0 votes
4 Comments
Kaustubha Govind
on 19 Oct 2011
Rostyk: set_param works with models AND blocks. See my answer for how I specify the full path to the block to set the parameter.
Rostyk Spolyak
on 24 Oct 2011
Kaustubha Govind
on 24 Oct 2011
set_param cannot handle a cell array of block paths (although get_param can). But it's fairly trivial to loop through the array:
bh = find_system('mymodel', 'BlockType', 'Fcn');
for i = 1:numel(bh), set_param(bh{i}, 'Expression', 'u*128+5'), end
Rostyk Spolyak
on 24 Oct 2011
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!