Hi,
I want to select a couple of rows by their index. The indexes I want to select is a random collection of numbers. I wasn’t able to find a solution. Any recommendations are welcome.
Thanks a lot, best regards, F
Hi,
I want to select a couple of rows by their index. The indexes I want to select is a random collection of numbers. I wasn’t able to find a solution. Any recommendations are welcome.
Thanks a lot, best regards, F
Try a select DAT with select Row by Condition and the following expression.
1 if int(me.inputCell.val) in [108, 99] else 0
Or if your indices are in a table, you can use a Merge DAT with the Replace Cells by Row option, with your index table as the first input to the merge…
cheers selina,
thanks, option 2 works great, thanks a lot.
for option 1, the incoming numbers are not constantly the same, but a occasionally changing array of 10 or so indices. so I can’t use [108, 99], but rather need to get all 10 values that are currently in a the first column of the table within the operator op(‘chopto1’).
i didn’t find a solution to get all values of a column of a table dat at once.
something like op(‘chopto1’)[*, 0] or something? if you have a hint on that, thanks in advance.
best regards!
dat.cols(0) is what you are looking for. Check out
for more options on data access.
What Selina said. That function returns cells though. If you need values, you can do a Python list comprehension.
[cell.val for cell in dat.col(0)]
or if you need numeric data:
[int(cell.val) for cell in dat.col(0)]