Embedded matlab block as a parameter - not an input (without "ports and data manager")

1 回表示 (過去 30 日間)
David Amor
David Amor 2013 年 12 月 18 日
回答済み: David Amor 2013 年 12 月 18 日
Hello,
When using an embedded Matlab block within Simulink, I would like to make the use of parameters more transparent by including definition of ports in the function i.e
function [ ...
... % Signals controlling stimulus
output_arg1 ,...
output_arg2 ]...
= Sequencer( ...
... % From Test Bench
time_in ,...
stop_time ,...
fixed_step_size ,...
... % From UUT
input_arg1 ,...
input_arg2)
% Function code
end
Where "fixed_step_size" is not an input port to the block but instead takes the value from the workspace - the value in the work space will not change over the duration of the simulation.
At the moment I am using the "ports and data manager" but this is not obvious when reviewing code.
so the question is: Is there a way to get a workspace parameter from the workspace - within the Matlab code, without using the ports and data manager?
Many thanks!
Dave

採用された回答

David Amor
David Amor 2013 年 12 月 18 日
sorry, I just found this:
coder.extrinsic('evalin')
fixed_step_size = evalin('base', 'fixed_step_size');
Dave

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaming Conventions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by