Please use our GitHub Issues page for all new support inquiries. If you need to contact us directly, please e-mail [email protected]

Eliminate Cell Duplication with Ruby API Code

I am familiar with the operation of Datavyu while I am less familiar with creating code. I need to fix my Ruby API code to eliminate duplicate cells. I am hoping for a simple solution to fix the code. Can someone help? I have been browsing these web pages:

Check for Coding Errors

Ruby API Reference

asked 04 Oct '16, 16:16

Williamsle's gravatar image

accept rate: 0%

By duplicate cells, I will assume you mean cells which share the same onset time. To identify duplicate cells in a column, you can use code similar to:

duplicate_cells = [] # store our duplicate cells in this list
prev_cell = my_column.cells.first
my_column.cells[1..-1].each do |c|
  duplicate_cells << c if(c.onset == prev_cell.onset)
  prev_cell = c

duplicate_cells.each do { |x| deleteCell(x) }

Let me know if you run into any more issues with this.

permanent link

answered 04 Oct '16, 19:51

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
accept rate: 14%

Thank you for your reply.

Datavyu will automatically display a red line between cells to indicate any errors which include duplicate cells. Therefore, duplicate cells are easy to see. I have a code that asks different variables to produce the same information, i.e. if x=1 show 1 and if y = 1 show 1. However, I do not need to see "1" multiple times, I do not require information about "x" producing the "1" or "y" producing the "1" because I am only asking if "1" is present or not present. Therefore, is there a simple code that eliminates the duplicate "1"?

(05 Oct '16, 09:01) Williamsle Williamsle's gravatar image

Would you be able to provide an example spreadsheet file or a screenshot of what your spreadsheet looks like? You can e-mail them to me at shohan(dot)hasan(dot)nyu(dot)edu.

I am not sure whether your spreadsheet has multiple codes within a column which gives you the information or whether you have multiple columns. In either case, you can condense the information systematically using a simple script.

(11 Oct '16, 17:57) Shohan Hasan ♦♦ Shohan%20Hasan's gravatar image
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: 04 Oct '16, 16:16

question was seen: 4,464 times

last updated: 11 Oct '16, 17:57

powered by OSQA