what is the problem with the second 'IF' loop ? Program terminates after entering into the loop.

2 visualizzazioni (ultimi 30 giorni)
I am able to enter into the second "IF" but the simulink program terminates after executing the lines in the second "IF" condition. Simulink runs for the required time without the second "IF" condition.
function [Out] = LMAImplementation_Motor(In)
persistent eWithNoChange eWithDeltaL eWithDeltaK
e = In(1);
L = In(2);
K = In(3);
Clock = In(4);
if (0.0000 <= Clock) && (Clock <= 0.9999)
deltaK = 0; deltaL = 0;
eWithNoChange(end+1) = e;
[m,n] = size(eWithNoChange);
end
if n == 30001 %THIS LINE WAS BOLD
eWithNoChange(:,1) = [];
sizeofeWithNoChange = size(eWithNoChange)
end
if (1.0000 <= Clock) && (Clock <= 1.9999)
deltaL = L*0.1; deltaK = 0;
eWithDeltaL(end+1) = e;
end
Out = [deltaL,deltaK,Clock];

Risposta accettata

kintali narendra
kintali narendra il 8 Giu 2016
The issue got solved, As I didn't define the variable "n" the program gets terminated, after defining the variable there is no more issue.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by