matlab function initiaizing the parameter
5 ビュー (過去 30 日間)
古いコメントを表示
I'm using embedded matlab function for my project. How to initialize the parameter just once at the beginning? some sort like this: kp = 0 (initialize once only) (the value of kp is updated after every loop running)....for more details i am using embeded matlab function to control the water flow rate in LAB flow rig control system ,,,Is that possible way of controlling ???
0 件のコメント
回答 (1 件)
Kaustubha Govind
2012 年 3 月 15 日
You can create kp as a persistent variable. For example:
function myTest()
persistent kp;
if isempty(kp)
kp = 0; % only initialized the first time
end
kp = kp + 1;
end
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!