Insert a snap shot from a trajectory into a given study table cell

Dear Discussion Dwellers,

I would like to insert a snap shot from a trajectory into a study table at given column number and row number. I've tried a few possible routes toward this end, but I keep getting an error that says "Invalid row index (function/property "Cell") at -e line 265". Here's an example of the code that I used (you can find the full program attached, where this particlar peice of code begins on line 264):

                           my \$snap_location = \$stats_sheet->Cell(\$frame_counter-1, 17);

                           \$system_doc->InsertInto(\$snap_location);

  

Where '\$system_doc' was specified earlier as:

                           my \$substrate_doc = Documents->New("substrate.xsd");

                           \$substrate_doc->CopyFrom(\$surfaceXTD);

I'm fairly certain that the use of '\$frame_counter-1' to specify row number is not the problem because I'm able to use it in other contexts. I suspect that the error arises from the fact that I'm working with a trajectory document and that I'm not accounting for this correctly.

I've seen at least one other similar post addressing this (https://community.accelrys.com/message/1791#1791), but it doesn't seem to clarify what I'm doing wrong (to me at least). I'd appreciate any advice on this problem.

Thanks,

Vanessa