File: HelloWorldDemo.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (38 lines) | stat: -rw-r--r-- 1,300 bytes parent folder | download | duplicates (6)
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
% HelloWorld - The most minimalistic example of a visual stimulus.

% Make sure Psychtoolbox is properly installed and set it up for use at
% feature level 2: Normalized 0-1 color range and unified key mapping.
% This allows to specify all color or intensity values in a normalized
% range between 0.0 (for 0% output intensity) and 1.0 (for 100% output
% intensity).
PsychDefaultSetup(2);

% Select the display screen on which to show our window:
% First we get a list of all display screens and store it in the vector
% 'screens':
screens = Screen('Screens')

% 'screens' contains a list of all available display screens, numbered
% from 0 to n. 0 usually corresponds to the first display on a setup,
% or the internal flat panel of a Laptop. We select the max()imum screen
% number as 'screenid' to show our window.
screenid = max(screens)

% Open a window on display screen 'screenid', with its default background
% color, which is white:
win = PsychImaging('Openwindow', screenid)

% Set a big text size:
Screen('TextSize', win, 48);

% Draw 'Hello World!' into the center of the screen:
DrawFormattedText(win, 'Hello World!', 'center', 'center');

% Show it on the display:
Screen('Flip', win);

% Wait for a keystroke on the keyboard:
KbStrokeWait;

% Done. Close the window and clean up.
sca;