Welcome! Log In Create A New Profile

Advanced

Pseudorandomization in userloop file

Posted by tonygao2004 
Pseudorandomization in userloop file
June 24, 2025 04:20PM
Hi Jaewon,

I am working on adding a pseudorandomization component in the study (in the userloop file). I am thinking of using TrialRecord.User to store the list, which is permuated by randperm(), so the conditions can be randomized while balanced in the block. When I run the code it bumps into an error of 'dot indexing is not supported for variables of this type' for the last line of code: 'TrialRecord.User.rotation_degree = TrialRecord.User.random_num_list(index); Do you have any clue about this? I have attached the entire code in the file. Please let me know if there is a way I can refine my code for this to run. Greatly appreciated.

(in the timing script I've called rotation_degree = TrialRecord.User.rotation_degree)

Thank you.
Attachments:
open | download - userloop_human_numerical_key.m (1 KB)
Re: Pseudorandomization in userloop file
June 24, 2025 05:09PM
Your TrialRecord.User.random_num_list is not defined unless the if statement is executed.
Re: Pseudorandomization in userloop file
June 24, 2025 07:49PM
Thank you for pointing it out!

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.