RCell Class

RCell Class

class RCell

The Ruby container for Datavyu cells.

classmethod RCell.change_code(code, val)

Changes the value of a code in a cell.

Parameter Type Description
arg String or Ruby column from get_column() Name of the code that you are updating.
val String, Integer, etc. Value to change the code to.

Returns

None.

Example

The following example sets the “trial” column’s cell at position 0’s onset to 1000ms, and then writes the change back to the spreadsheet using set_column().

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   trial.cells(0).change_code("onset", 1000)
   setColumn("trial", trial)
end
classmethod RCell.is_within(outer_cell)

Determines if a cell is temporally encased by the outer_cell.

Parameter Type Description
outer_cell   The cell that is going to be checked to see if it temporally encases the study cell.

Returns

Boolean

Example

Compare the first cell of the “trial” and “id” columns to see if the first cell of “trial” is temporally enclosed by the first cell of “id”. If it is, print out “Yes, it is temporally enclosed”, otherwise, print “No, it is not temporally enclosed.”

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   id = getColumn("id")
   if trial.cells[0].is_within(id.cells[0])
      puts "Yes, it is temporally enclosed."
   else
      puts "No, it is not temporally enclosed."
   end
end
classmethod RCell.contains(inner_cell)

Determines if a cell temporally encases the inner_cell.

Parameter Type Description
inner_cell   The cell that is going to be checked to see if it is temporally encased by the study cell.

Returns

Boolean

Example

Compare the first cell of the “trial” and “id” columns to see if the first cell of “trial” is temporally enclosed by the first cell of “id”. If it is, print out “Yes, it is temporally encloses the cell”, otherwise, print “No, it is does not temporally enclose the cell.”

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   id = getColumn("id")
   if id.cells[0].is_within(trial.cells[0])
      puts "Yes, it is temporally encloses the cell."
   else
      puts "No, it is does not temporally enclose the cell."
   end
end
classmethod RCell.print_all(*p)

Dumps all of the codes in a cell to a string.

Parameter Type Description
p optional String The separator between codes. Defaults to tab (t)

Returns

String of the codes, starting with ordinal, onset, and offset, followed by the codes.

Example

The following example prints all of the “trial” column’s first cell’s codes using print.

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   print trial.cells[0].print_all()
end