getCellFromTime()

getCellFromTime()

getCellFromTime(col, time)

Identifies the cell that occurs at a given point in time for the specified column, and returns it.

Parameter Type Description
col String or RColumn object Name or Ruby representation of the column that you are looking for a cell within.
time Integer Time (in milliseconds) that you want to identify the cell that happens then.

Returns

Returns the Ruby representation of the cell at the specified point in time. If there is no cell at that point in time, Ruby does not return anything.

Example

The following example identifies the cell that occurs at 100ms in the “trial” column, and assigns it to a RCell object. It then prints out the cell’s ordinal, onset, and offset codes for easy location.

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   cell = getCellFromTime(trial, 100)

   # Get the ordinal, onset, offset
   # values from the cell, and assign them to
   # string variables, so we can print them out
   ordinal = cell.ordinal.to_s
   onset = cell.onset.to_s
   offset = cell.offset.to_s

   # Print out ordinal, onset, and offset, and their values
   puts "ordinal: #{ordinal}"
   puts "onset: #{onset}ms"
   puts "offset: #{offset}ms"

end