How to define a persistent array in an Embedded function

14 views (last 30 days)
I want to define some persistent arrays in an embedded function,and change their walues in cycles,but I don't know how to define this. I had trid this:
persistent X;
if isempty(X)
X=0;
end
but obviously,it's wrong. Please help me,thanks

Answers (1)

Kaustubha Govind
Kaustubha Govind on 31 Oct 2012
How about:
persistent X;
if isempty(X)
X=zeros(1,5);
end

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!