the output of my embeded matlab function is not updated inside the " for loop", display only the last result of the for loop
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!