Error in 'DrawTexture'

3 visualizaciones (últimos 30 días)
Alix
Alix el 6 de Sept. de 2019
Respondida: Alix el 10 de Sept. de 2019
Hi everybody,
I'm quite new to the whole matlab experience and I'm hoping someone can help me out with this.
I'm using a script to convert images to texture/mat files, that has worked before. But when put it in my main script and run it, I get the following error, anybody out there who can help =)?
Thank you so much!
Error in function DrawTexture: Missing argument
Discrepancy between a specified and supplied argument:
Specified Argument Description:
direction: Input
position: 2
presence:forbidden
formats allowed:
double
minimum M: 1
maximum M: 1
minimum N: 1
maximum N: 1
minimum P: 1
maximum P: 1
Provided Argument Description:
direction: Input
position: 2
presence: absent
Error using Screen
Usage:
Screen('DrawTexture', windowPointer, texturePointer [,sourceRect] [,destinationRect] [,rotationAngle] [, filterMode]
[, globalAlpha] [, modulateColor] [, textureShader] [, specialFlags] [, auxParameters]);
Error in encoding_2 (line 219)
Screen('DrawTexture', win, tex(trial_order(trial+1))); %uses loadJPG_as_Texture.m
  13 comentarios
Alix
Alix el 8 de Sept. de 2019
Thank you both, I got it to work now finally =) just in time.
Enjoy the rest of your weekend!
Guillaume
Guillaume el 9 de Sept. de 2019
As it may be helpful for others to know what the solution was, could you post it as an answer and then accept your own answer?

Iniciar sesión para comentar.

Respuesta aceptada

Alix
Alix el 10 de Sept. de 2019
Yes, sorry! It was so simple in the end:
1) I made sure that only jpg's are in the stimulus folder (as the transformation function posted above counts all files, which gives an error later in the script when it seems as if there are more files to be read in then there actually are)
2) when writing your script as a function 'tex' is not a texturepointer but refers to something else (as @Walter suggested in the beginning). So, when converting jpg to texture, instead of saying
tex(nfile) = Screen('MakeTexture', win, img);'
I changed it to
imgtex(nfile) = Screen('MakeTexture', win, img);'.
In the main script, it now reads
Screen('DrawTexture', win, imgtex(trialList.stimNr(trial)));
btw. tested it under the scanner (fMRI) yesterday and it works like a charm =)
Thank you guys again!

Más respuestas (0)

Categorías

Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by