I use this function in 2 independent scripts. In the first it works without a problem. When I adress it in a second (seperated) script, it gives the error:
Output argument "PulsTijd" (and maybe others) not assigned during call to (location). I read other threats about this topic without result.
What is the way to resolve this problem please?
function[Pulsen,VerlopenTijd,Totaal,PulsTijd] = PulsenTeller(Data,TijdArray,Start,Einde)
Totaal = ones(1,length(TijdArray))-1;
Pulsen = 0;
Q = 0;
NietInPuls = true;
Tijd = 0;
PulsGevonden = false;
DrempelVoltage = 5;
for i=Start:Einde
if i > Start Totaal(i) = Totaal(i-1); end if (Data(i)>DrempelVoltage) && NietInPuls NietInPuls = false; if PulsGevonden Tijd = TijdArray(i)- TijdStart; Pulsen = Pulsen + 1; Totaal(i) = Totaal(i)+1; else TijdStart = TijdArray(i); Totaal(i) = 0; Pulsen = 0; end PulsGevonden = true; elseif Data(i) <= DrempelVoltage NietInPuls = true; endend
for i=Einde:length(Data)
Totaal(i)=Totaal(Einde);end PulsNummer=1; InPuls=false; PulsGevonden=false;
for i=Start:Einde
if i > Start Totaal(i) = Totaal(i-1);end if Data(i)>DrempelVoltage InPuls=true; else if(Data(i)<DrempelVoltage) && InPuls InPuls=false; if PulsGevonden PulsNummer=PulsNummer+1; BeginTijd(PulsNummer)= TijdArray(i); PulsTijd(PulsNummer)= BeginTijd(PulsNummer)-BeginTijd(PulsNummer-1); else BeginTijd(PulsNummer)=TijdArray(i); PulsNummer=1; end PulsGevonden=true; end endend
VerlopenTijd = Tijd;
Best Answer