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

2 Ansichten (letzte 30 Tage)
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];

Akzeptierte Antwort

kintali narendra
kintali narendra am 8 Jun. 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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by