while loop in simscape language
이전 댓글 표시
Hi, I'm having some troubles in creating ssc file where I need to use while loop (or maybe for). Here is my code:
parameters
gain = { [0 0 1/3], '1' }; % Gain
max={[0.3 0.1 0.25],'1'} %Maximum pressures
end
parameters
stop = { 0, '1' };
k={1,'1'};
end
equations
while stop<1
if I<=sum(max(1:k))
stop=1;
coef=gain(k);
end
k=k+1;
end
O == coef * I;
end
And when I try to build library with ssc_build I get message like this:
Illegal flow control construct 'while' in equation block
Am I doing something wrong, or there is no possibility in simscape language to use "while" and "for" statements (although conditional "if" is allowed)?
Thanks in advance.
채택된 답변
추가 답변 (1개)
Vishnu Teja Vithala
2018년 7월 9일
2 개 추천
I agree, Simscape not supporting while and for loops is pretty big limitation
카테고리
도움말 센터 및 File Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!