Post by mb3258 on Apr 16, 2024 14:21:10 GMT
Hello, I have two arrays that include the same set of fruit images except that one has everything as a smaller size. In my first array, I randomized the array so that each participant sees a different subset of photos. Now, I need to make sure that the same photo in the smaller versions also appear on the screen. My first instinct was to do this:
Which I believe should work if my array was a numerical array and not a string array. But currently all of my fruit images are being recorded as strings (e.g., "1", "2", and "3"). Does anyone have any ideas on how I can make sure these two arrays match? I really appreciate it!
Edit: I have another idea on how I think I could go about this in a way that would work for the rest of my task; I was thinking to make a table with two columns, one for each size, and where each row is a fruit. Then randomize the rows and assign each of the columns to be in a global array and that way they'd end up in the same order, but randomized between participants. Any idea how I might randomize the tablerows?
Edit2: I did something similar to my example below, where I have a table of two columns, one for each sized fruit. I randomized the table rows, then attempted to fill two arrays with the values of the shuffled table rows. My code appears to be getting stuck in the "while" loop. I'm not entirely sure why, if anyone else has any thoughts!
task random
set %%fruit apple banana orange
set %%fruitSmall appleSmall bananaSmall orangeSmall
set %%fruit shuffle no_repeat
task training
show bitmap %%fruitSmall[%%fruit[1]]
Which I believe should work if my array was a numerical array and not a string array. But currently all of my fruit images are being recorded as strings (e.g., "1", "2", and "3"). Does anyone have any ideas on how I can make sure these two arrays match? I really appreciate it!
Edit: I have another idea on how I think I could go about this in a way that would work for the rest of my task; I was thinking to make a table with two columns, one for each size, and where each row is a fruit. Then randomize the rows and assign each of the columns to be in a global array and that way they'd end up in the same order, but randomized between participants. Any idea how I might randomize the tablerows?
Edit2: I did something similar to my example below, where I have a table of two columns, one for each sized fruit. I randomized the table rows, then attempted to fill two arrays with the values of the shuffled table rows. My code appears to be getting stuck in the "while" loop. I'm not entirely sure why, if anyone else has any thoughts!
table fruit
"apple" "appleSmall"
"banana" "bananaSmall"
"orange" "orangeSmall"
task random
table fruit
set %%fruit 0 # make 2 arrays, one for each size fruit
set %%fruitSmall 0
set &&my_rows range 1 4
set &&my_rows shuffle no_repeat
set $i 1
while $i < 4
set $tr &&my_rows[$i]
tablerow $tr
set %%fruit[$i] @1
set %%fruitSmall[$i] @2
set $i increase
while-end
set %%fruit remove first # removes the 0 I used to create the array
set %%fruitSmall remove first
block random
tasklist
random 1
end