Skip to content

setVariable

Jesse Lingeman edited this page Mar 6, 2013 · 2 revisions

Purpose

Write a variable back into the Datavyu database. NOTE: If you do not write a variable back, then no changes made to the variable inside of a Ruby script will be saved back to the database.

Parameters

Name (optional)

Sets the name of the variable being written back into Datavyu

RVariable to write back

The variable that you want to write back to the database.

Examples

# Get the variable from Datavyu
trial = getVariable("trial")

# Change something
for cell in trial.cells
    if cell.onset == 0
        cell.change_arg("onset", 1000)
    end
end

# Now write back the changes
setVariable(trial)

# Alternatively, you can write it back to a new column, keeping both
setVariable("modified_trial", trial)