outputs to workspace not visible

7 ビュー (過去 30 日間)
Amardeep
Amardeep 2011 年 10 月 31 日
Greetings all; I am running simulink from a Matlab script using the sim command and have inputs all as constants from the base workspace and am trying to output to the current workspace. However when I try to use the outputs I get the error that the output is an undefined function or variable (the inputs are being pulled in correctly).
I am calling the sim thusly:
myopts = simset ('ReturnWorkspaceOutputs','on','DstWorkspace','current'); sim('model',[],myopts);
My outputs are done as 'To Workspace' blocks. I have tried pre-defining the outputs but they dont then get written over with data after the model runs. I have left the time option empty as its a single run and thats all defined in the configuration parameters.
Regards
Amardeep

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 31 日
Your 'script' must have been a M-function, instead of a M-script. Setting 'DstWorkspace' to be 'current' means sending the output to the current workspace. You need to set it as 'base'.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by