How to define a persistent array in an Embedded function
显示 更早的评论
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
3 个评论
Kaustubha Govind
2012-10-29
How about:
persistent X;
if isempty(X)
X=zeros(1,5);
end
honglin
2012-10-30
Kaustubha Govind
2012-10-31
Glad it helped! I added an answer with that code - could you please accept it if is resolves the question?
回答(1 个)
Kaustubha Govind
2012-10-31
How about:
persistent X;
if isempty(X)
X=zeros(1,5);
end
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!