Store "From Workspace" Variable into array in Simulink

조회 수: 16 (최근 30일)
Andreas Harter
Andreas Harter 2016년 7월 14일
댓글: Andreas Harter 2016년 7월 18일
My Simulation get's an array as input from the workspace. How can I store the last 100 of these values in a [100 1]-array and send them to a function for further calculation? I tried GoTo-Tags, Data-Memory-Blocks and Embedded Functions but it doesn't seem to work.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 14일
Use matlab function block with this code
function y = fcn(u)
%#codegen
persistent k z
n=10
if isempty(k)
k=0
z=zeros(1,n);
end
z=[z(2:n) u]
y=z
%

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by