Making a fullscreen movie in MATLAB

So I'm trying to make a movie on MATLAB that contains some grey circles at specific locations, with one of the circles going from black to white over the course of it. However I can't get it to only record the images over the whole screen at the right resolution instead of showing it in a figure window. Here's what I've got so far:

pcf=circ(1920,1080,18,1520,504,2); %Makes the circles

for ii=1:256
    pcfl=pcf*(ii-1)/255; %Steps through greylevels
    m=h.*(trap1+trap2+pcfl); %Make everything but the circles black    
    hfig=imshow(m); %Display image
    colormap('gray') %This is probably unnecessary

myVideo = VideoWriter('trapmov.avi');

I've found this and this which seem close to what I want (esp. the second one), but I don't know enough about java to be able to make a movie from the first one, and the second one doesn't work because it claims the image resolution isn't 1920x1080 - I think this is because MATLAB scales it before the function has a chance to 'get to it', as it were.

I could possibly make it work by just saving the image from each iteration of the loop and making a .gif out of it, but I'm not sure how I'd get that to display fullscreen and it would be a lot nicer to be able to control playback with VLC.

There's also ways to do this with normal plots:

set(hfig,'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);

but this only works on objects created with plot commands, not image/imshow.

EDIT: OK I gave up and just made a .gif and it works in chrome's fullscreen mode, but a solution to this would still be nice since it seems like a fairly useful thing to know how to do.


I would do this by using psychtoolbox. It is a much more appropriate starting point than Matlab's figure classes. The package is built for Matlab and comes with a lot of demos which can easily be altered to generate your stimulus.

If you want to generate a movie, you can grab the full screen frames out of psychtoolbox with

imageArray = Screen('GetImage', wPtr, [0 0 1024 768]);

where wPtr is the pointer to a window you've created and the vector is the screen dimensions. You can find more details on this here

On the off chance that you're doing behavioral testing or psychophysics... I'd really stick with psychtoolbox and ignore VLC.

Need Your Help

Call to ListView's setEmpty method not working (nothing is displayed when the list is empty)

android listview

I have an Activity which contains a ListView defined in XML (its not subclassing the ListActivity class).

C# Event doesn't fire when I change text in the textbox

c# event-handling

The TextChanged event doesn't fire when the user changes the text. I think it may be an error with the generated code.