Random Colour in Drawformattedtext Function in Matlab
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
James Ryley
el 9 de Mzo. de 2021
Comentada: James Ryley
el 9 de Mzo. de 2021
Hi, I am trying to get my text to be a random colour of either blue, yellow or red. It is for a *very* simple stroop test on psychtoolbox in matlab.
DrawformattedText(w, thisStimulus, 'center', 'center', [], 60)
I am wondering if there is a way to insert a function which randomly sets the text to one of those three colours? That could be either inserted in the DrawformattedText brackets or at the beginning of the trial.
Thanks in advance
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de Mzo. de 2021
DrawformattedText is part of psychtoolbox but not part of MATLAB.
cmap = [0 0 1; %blue
1 1 0; %yellow
1 0 0]; %red
color = cmap(randi(size(cmap,1)),:);
DrawformattedText(w, thisStimulus, 'center', 'center', color, 60)
Más respuestas (0)
Ver también
Categorías
Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!