flickering gabor

I am new to matlab, so forgive me. I am having trouble understanding the correct way to implement a flicker for a full screen gabor. For this flicker, I have taken parts of the program from AsyncFlipTest. The code I am using currently:

 

while ~KbCheck(device)

    tv1 = Screen('AsyncFlipEnd', window);

 

    Screen('DrawTextures', window, gabortex, [], [], orientation, 0, [], [],   [],kPsychDontDoRotation, propertiesMat');

 

    Screen('AsyncFlipBegin', window, tv1 + ifi/2);

   

    Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);

 

end

 

 

 

 

I have two questions regarding this:

 

1: correctly calling the command- how to include the contrastmodulation parameter used in the first part of the program, for the red screen (from AsyncFlipTest), but for the gabor. Where the red flickering screen would be a lower contrast red.

 

 

2: correct timing- may seem like a simple question, but if I wanted to vary the Hz the screen was flickering at, I have been trying to do this via refresh rate of the screen, and then implementing this into the flip. As I am calling two flip functions in order to make the stimuli flicker, I assume this gives me incorrect timing of the stimuli presented. This question, I suppose relates to the first question in correctly calling the command.