-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeDisplayColor.m
More file actions
44 lines (30 loc) · 963 Bytes
/
Copy pathmakeDisplayColor.m
File metadata and controls
44 lines (30 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%Program to display a color of a given RGB code on the full screen
function makeDisplayColor(RGB)
imSize = 800;
img = zeros(imSize,imSize,3);
img(:,:,1) = RGB(1);
img(:,:,2) = RGB(2);
img(:,:,3) = RGB(3);
try
screens=Screen('Screens');
screenNumber=max(screens);
PsychDefaultSetup(2);
% Open a double-buffered fullscreen window:
w=Screen('OpenWindow',screenNumber);
[width, height]=Screen('WindowSize', w);
Screen('FillRect',w, RGB);
% We also abort on keypress...
if KbCheck
% Shut down realtime-mode:
Priority(0);
% We're done: Close all windows and textures:
Screen('CloseAll');
end
catch
%this "catch" section executes in case of an error in the "try" section
%above. Importantly, it closes the onscreen window if its open.
Priority(0);
Screen('CloseAll');
psychrethrow(psychlasterror);
end %try..catch..
end