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

2 ビュー (過去 30 日間)
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];

採用された回答

kintali narendra
kintali narendra 2016 年 6 月 8 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaming Conventions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by