MATLAB/Psychtoolbox color models not the same

>Dear David and Denis,
>
>I am a beginner in PsychToolBox, and I am sorry in advance for the poor
>explanation of my problem. Could you also please take a look at two
>files attached.
>
>First file 'rds_cb.m' is creating a random dot stereogram checkerboard,
>ploting it into a figure and then saving it as 2-D (M*N) matrix.
>Then I add 3-dimension to the matrix - frames (f=1:10). The program
>generates a new
>random dot field for each frame (i).
>
>Second file 'TestRDS.m' tries to present this matrix as a movie.
>The problem is that instead of black screen with red and green and yellow
>dots (as was in my Matlab figure) there is only a blank white screen
>and only little patches (created in rds_cb.m) - the rectangle in
>left upper corner
>and a cross in the centre of the picture are visible when I run TestRDS.m.

There was something slightly broken about the test files, rds_cb
didn't actually save anything. Perhaps the last few lines were
lost as part of the attachment decoding process. In any case, from
what you sent I can't figure out exactly what you were doing, since
nether script ran without error and the key parts that define what
data the first was generating for the second were not present.

But in any case, I am pretty sure about what your problem is.
In rds_cb, you use MATLAB conventions to define what
colors actually go up in the figure window. That is, you
pass color arguments (e.g. 'y', 'g', etc.) to the plot command.

The toolbox does not use MATLAB conventions to define colors,
so things won't work the same as if you were plotting an image
into a MATLAB figure. When using SCREEN (as in TestRDS),
you must use the color model of the toolbox, not the one used
by MATLAB figures (or the MATLAB imshow/image functions
either).

In the toolbox, colors are defined by what numbers get written
into the frame buffer and what values are in the color lookup
table. So you need to understand the frame buffer/lookup
table concepts. One place to read about this is in the chapter
we wrote on calibration. Download it at
<http://color.psych.ucsb.edu/brainard/characterize.pdf>.

Once you understand the ideas, which I think are fairly straightforward,
then you just have to modify your code to put known numbers into the
frame buffer at each position and write an appropriate lookup table with
SCREEN(window,'SetClut',....).

Best,

David