How can I specify a sim. start point?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Schedule Model Components 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by