How to define a persistent array in an Embedded function

15 visualizaciones (últimos 30 días)
honglin
honglin el 29 de Oct. de 2012
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 comentarios
honglin
honglin el 30 de Oct. de 2012
Thanks,it's userful for me.
Kaustubha Govind
Kaustubha Govind el 31 de Oct. de 2012
Glad it helped! I added an answer with that code - could you please accept it if is resolves the question?

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by