OS (e.g. Win10): Win10
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.1.3
Standard Standalone Installation? (y/n) If not then what?: y
Do you want it to also run locally? (y/n) y (in PsychoPy)
What are you trying to achieve?:
I am trying to constrain “Selected Rows” into a subset of the CSV file.
In every trial loop, I randomly select 4 out of 6 rows of my CSV file.
The 4 rows aren’t necessarily sequential.
It could be something like: useRows = [5,2,1,0]
And then I put $useRows in the “Selected Rows” section of my loop.
This works in PsychoPy but not Pavlovia (JavaScript).
My attempt in JavaScript looks like:
var useRows1 = useRows_set[loop1.thisN];
var useRows = useRows1.join(“,”);
useRows_set is a 6x1 array of 4 numbers. For example:
0: (4) [3, 2, 0, 4]
1: (4) [1, 0, 2, 4]
2: (4) [4, 1, 2, 3]
3: (4) [1, 2, 4, 5]
4: (4) [1, 5, 0, 4]
5: (4) [5, 3, 0, 1]
What did you try to make it work?:
Following online leads, I have tried converting this to a string, such as “5,2,1,0” but I still see the same error.
Link to the most relevant existing thread you have found:
What specifically went wrong when you tried that?:
Changing useRows into a string did not resolve my issue.
Unfortunately, I don’t have a more descriptive error message than this:
- when importing condition: Spreadsheets/practice.csv
RangeError: Invalid array length
No empty rows or columns, no spaces between variables in the CSV file.
I would appreciate any help, thank you so much!