Sending value to specific cell in table dat

Hi everybody,
I’m really a beginner in python, but I can see how powerful it could be. I want to control a camera on a rail with stepper motors. For this part, I have no problem (with arduino, Firmata, endstops,…). The thing is: I’d like to send the camera to specific places on the rail, so to do this, I first built my scene in TD in 3D, and made a system with a counter and an analyze. So, I would like to fill a table dat with 1 row and 180 columns and send the value that I get in the analyze chop (0 or 1) to the corresponding cell (from 0 to 180). 0 to 180 are the values of the counter that corresponds to 180 frames. I hope I’m clear.
Thanx
Manu

Hi @manut - do you have a starting point of this project? It’s often easier to give someone a nudge if we can see what you’ve already tried.

The syntax for what you’re trying to do should be something like:

op('someTableDAT')[ theRowIndexOrName, theColumnIndexOrName] = theValueYouWantToSet

Thank you very much Matthew ! It worked like a charm :slight_smile:
Sorry for not have sent where I was, but I was really nowhere :wink:
As I told you, I’m really new to Python, but for a couple of days now, I begin to enjoy it :slight_smile:
I have another question for this project about incrementing tiff I’d like to save, with incremented names but it’s maybe better that I open a new topic …
Thanx again
Manu

Are you using the moviefileout TOP? There’s an increment value there that can help make this bit much easier.

Hi Matthew,
Thank you, I succeeded to save tiffs with increments :slight_smile:
I have another question: I would like to be able to dynamically create and name new folders (incremented as well) in which I will save the tiffs. I simply tried to put the name of a new folder in the path but it didn’t work , I had to create it first before being able to save the files into it. In my case, I created the folder ‘images’ in my samples folder.
increment_save.toe (4.4 KB)

And by the way, thank you as well for your great tutorials on the web :+1:

hi @manut - I’m glad the tutorials help!

When it comes to making directories you’re on your own there. I don’t think there are any built in TD features that will help you with that part. That said, it’s not too complicated to do with python. This is handled by the os module (os — Miscellaneous operating system interfaces — Python 3.11.2 documentation). You’ll need to write a little script to handle the directory names, and then creating them.

Thanx, I’m going to try this.