Presenting stimuli at different locations

Hi everyone,

I'm relatively new to Matlab, I've used NBS Presentation previously which is alot simple in terms of coding.

So I've made a script where 2 stimuli are shown in succession. The first stimulus (A) is shown at the centre of the screen, whereas the successive stimulus (B) must be shown off-centre, either to the left, right, top or bottom of the centre of the screen.

I'm familiar with the rect function of psychtoolbox, but wasn't sure how to present stimulus B in either of those positions (in a random order across trials).

I've considered making a function where if t=a certain number, then rect = certain position, would this be a logical option?
If anyone could point me in the right direction that would be great and save me alot of MATLAB frustration.

Thanks in advance,
Dave.