필터 지우기
필터 지우기

matlab function initiaizing the parameter

조회 수: 1 (최근 30일)
teesside university
teesside university 2012년 3월 15일
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 ???

답변 (1개)

Kaustubha Govind
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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by