Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

NaNs and RecordCounts.


Peter R. Mar 4, 2015 12:24 AM

OK, this seems absolutely ridiculous that I need to ask these questions but they're killing me.

1) How does one check for NAN? There's no constant defining NAN, no method isNAN so how can I tell if a variable is actually NAN - which in my case is actually null.

2) How do you get a record count from a table. I've been through all the table functions but cannot seem to find it. I need to know how many records are in a table.

Thanks in advance!


ryan42 Mar 4, 2015 04:05 AM

Hi Peter,

From memory just

public someVariable
If someVariable = NaN then
'do something
someVariable = -9999999999
EndIf

Should do it. As for the current record

public recNumber, battVolts

DataTable(test,True,-1)
DataInterval(0,5,min,0)
Sample(1,battVolts,FP2)
EndTable

recNumber = test.record(1,1)

Hope that helps.

Cheers
Ryan


Dana Mar 5, 2015 08:09 PM

As Ryan points out, NAN is a predefined constant in the datalogger, so you can use it in your expressions (there is a list in the CRBasic Editor of predefined constants).

If you look in the help file index under "data table access" there are functions to return information from tables. One of the options is "TableSize". So, based on Ryan's example above,

RecNumber = Test.TableSize(1,1)


Dana

Log in or register to post/reply in the forum.