Filter löschen
Filter löschen

matlab function initiaizing the parameter

1 Ansicht (letzte 30 Tage)
teesside university
teesside university am 15 Mär. 2012
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 ???

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 15 Mär. 2012
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

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by