how to use matlab function in simulink when there are several while loops in function?
显示 更早的评论
I was trying to execute a matlab function in simulink and i found below error.
Errors occurred during parsing of MATLAB function 'MATLAB Function'. I tried to debug it myself and found that if i remove While loop from it then every thing works simply fine.
One more error appeared and that was Variable 'HC' is undefined on some execution paths. the variable HC get its value in a while loop only and some execution path it is coming as undefined. So is there any problem if a loop is executed through a matlab function in simulink or the problem is something else? whats the solution for this?
I am not able understand this problem and while loop is inevitable part of that code. please suggest the solution so that i can run this code as part of simulink simulation.
回答(1 个)
Walter Roberson
2012-12-12
0 个投票
Just assign some value to the variable before the while loop starts.
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!