Announcing the new Datavyu v1.4.0 with enhanced features, bug fixes, and a new video player for Windows!

We are in the process of migrating away from this forum—feel free to browse existing help topics. For new support inquiries, please reach out to us via email at

I'm working with a simple data set in which I'm using two nested columns. I'll call them column A, which has one cell close to the length of the entire session, and column B, where for about half the files, we're coding short bouts of target behavior. However, for some cases, our participants don't ever exhibit the behavior of interest. So we have data in column A but nothing in column B.

Is there a way to write a script that will export both column A and B for cases where we have data in both columns, and just one row with the column A data for cases where we have no cells in column B?

Would it be simpler to create one cell in column B to the right of the one cell in column A, and just enter "." for all arguments?

asked 23 Jan '14, 21:10

LisaHurwitz's gravatar image

accept rate: 0%

script attached below, please change file directories and column names as necessary. i'll send you the sample spreadsheet as well.

require 'Datavyu_API.rb' begin

filedir = "/Users/motoruser/Desktop/sample/"
filenames =

dir = File.expand_path("~/Desktop")
out_file = + "/sampleprint.txt", "w")

for file in filenames
    if file.include?(".opf") and file[0].chr != '.'

        puts "LOADING DATABASE: " + filedir+file
        $db,proj = load_db(filedir+file)

        columnA = getVariable("columnA")
        columnB = getVariable("columnB")

        for acell in columnA.cells
            withinacell = # we put all bcells that nest within the current acell into a new array
            for bcell in columnB.cells
               if bcell.onset >= acell.onset and bcell.offset <= acell.offset
                   withinacell << bcell
            if withinacell.length == 0 # if there arent any cells that nest
                withinacell.each do |thiscell|


permanent link

answered 24 Jan '14, 16:22

GladysChan's gravatar image

GladysChan ♦♦
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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 23 Jan '14, 21:10

question was seen: 3,521 times

last updated: 24 Jan '14, 16:22

powered by OSQA