forked from OpenSHAPA/openshapa
-
Notifications
You must be signed in to change notification settings - Fork 21
change_arg
Jesse Lingeman edited this page Aug 27, 2013
·
1 revision
Changes the value of an argument in a cell
The name of the argument in the cell. The arguments "onset" and "offset" are available for all cells. For a matrix variable you can then access the rest of the arguments by their name. I.e., if you have a cell with an argument called "trialnum", you would use "trialnum" as the argument name. If the cell is a text or nominal cell, then the only argument in the cell is called "var".
The value you want to change the argument to
# Get a variable called trial from the database, store it in a Ruby variable called trial
# Trial is a matrix variable
trial = getVariable("trial")
trialnum = 0
onset = 1000
for cell in trial.cells
cell.change_arg("onset", onset)
cell.change_arg("trialnum", trialnum)
# Update the onset and trialnum
onset += 1000
trialnum += 1
end
# Now an example using a text variable
comments = getVariable("comments")
# This will change all of the comments in that column to "TEST"
# (not very useful in real life but is an example of using the variable name "var")
for cell in comments.cells
cell.change_arg("var", "TEST")
end