Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
the output of my embeded matlab function is not updated inside the " for loop", display only the last result of the for loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
My code consist to read one by one the elements of my vector input with a for loop, before I send it to another block function, the output of this block function is reinjected to my embeded function .
if true
function [Power,dutty] = Evaluation_fun(par,I)
eml.extrinsic('pause');
N=size(par,1);
%%%%%%%%%%%%%initialisation des variables%%%%%%%%%%%%%%%%%
persistent P
if isempty(P)
P = zeros(N,1);
end
persistent M
if isempty(M)
M = 0;
end
persistent cur
if isempty(cur)
cur = zeros(N,1);;
end
%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dutty=0; Power=zeros(N,1); for i=1:N M = par(i,:); dutty=M; pause(0.5); cur(i) = I;
P(i)=cur(i)*cur(i);
Power(i)=P(i);
end
end
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!