Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!

How do I use a script to delete cells from a variable?

asked 04 Oct '11, 09:01

KariKretch's gravatar image

KariKretch
31224
accept rate: 0%

edited 23 Jul '12, 09:40

Clinton's gravatar image

Clinton
111171924


All of the cells for a column are stored in the "cells" array of that column. The best way to delete them is to match the cells you want with some if statement, then just use the Ruby Array argument "delete" to delete them.

For example, say I had a column called "trial" that had an argument called "hand", that could be "l" or "r" (meaning left or right hand). For some reason, I want to delete all of the cells that were coded as a left hand.

# First get the column from the database
trial = getVariable("trial")

# Now loop through all of the cells in that column, checking if
# they are coded as a left hand.
for cell in trial.cells
   # Is hand coded as "l" for this cell?
   if cell.hand == "l"
      # If yes, then delete it from the cell array.
      trial.cells.delete(cell)
   end
end
permanent link

answered 26 Jan '12, 09:07

Jesse's gravatar image

Jesse ♦
11181015
accept rate: 53%

permanent link

answered 30 Mar, 10:52

andrei's gravatar image

andrei
362
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×18
×4
×2

question asked: 04 Oct '11, 09:01

question was seen: 3,928 times

last updated: 30 Mar, 10:52

powered by OSQA