psychopy.org | Reference | Downloads | Github

Function is not defined

I am having an issue where I am trying to run this function,

function star_chos_blue(i){
switch(i){
case “Red_9-1.png”:
return(9);
case “Red_8-2.png”:
return(range(2,8).sample());
case “Red_7-3.png”:
return(range(3,7).sample());
case “Red_6-4.png”:
return(range(4,6).sample());
case “Blue_6-4.png”:
return(range(6,4).sample());
case “Blue_7-3.png”:
return(range(7,3).sample());
case “Blue_8-2.png”:
return(range(8,2).sample());
case “Blue_9-1.png”:
return(range(9,1).sample());
}
}

I am getting the error that star_chos_blue is not defined. I have it in the beginning of my code, so I am not sure why it would not be defined or that it is being saved in the local scope instead of the global?

You need to start with star_chos_blue = function(I)

Check my crib sheet for examples if necessary.

Dude! You’re amazing, thank you so much!

1 Like