Search code examples
ti-nspire

How t check if a value is undefined in a matrix?


I have a matrix ratiotest:= [undef;undef;4].

Local i
Local ratiotest

for i,1,rowDim(ratiotest),1
 if ratiotest[i] = "undef" Then
  ∞→ratiotest[i]
 end if
endfor

But I get "Error: Variable is not defined"

Is there anyway to detect a undefined variable ? Im am missing something in the code ?


Solution

  • Use the construct IfFn. The fourth argument will be returned if the first argument is undefined. Therefore

    IfFn(x,false, false, true) 
    

    is true only for x being undefined.