How can I specify a sim. start point?

1 回表示 (過去 30 日間)
Michael Hodgson
Michael Hodgson 2021 年 10 月 7 日
My sim. has feed-back, and the code in the feed-back loop, in a "Matlab function block," is producing an error which makes it seem that the output variable is not getting populated before going into the feed-back loop code:
"=== Simulation (Elapsed: 10 sec) ===
Error:Index expression out of bounds. Attempted to access element 2. The valid range is 1-1.
More information
Function 'Matlab function for u1.' (#30.146.147), line 7, column 17:"
where line 7 in the "Matlab function block" code is:
h2 = heights(:, 2);
where "heights" is my output variable. If the sim. started at the input, this error should not occur. "Heights" shows in the Workspace as being fully populated (from a previous run, which didn't use the above feed-back loop). Does the sim. use a separate workspace? Is that what the "Model Workspace" in the Model Explorer is? Currently it's empty, so something is definitely not working.

回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by