Update Psychtoolbox Installation authored by petra borovska's avatar petra borovska
## Description ## Description
This manual should help you to successfully install **Psychtoolbox** in your MATLAB. This instructions are created mainly for Windows, but you can find details on installing Psychtoolbox also for other OS, please follow this [website](http://psychtoolbox.org/download.html) This manual should help you to successfully install **Psychtoolbox** in your Matlab. This instructions are created mainly for Windows, but you can find details on installing Psychtoolbox also for other OS, please follow this [website](http://psychtoolbox.org/download.html)
## Steps ## Steps
1. First open your MATLAB as administrator (right click on MATLAB launcher - *Run as administrator*) 1. First open your Matlab as administrator (right click on MATLAB launcher - *Run as administrator*)
2. Double check if you don't have the version already installed by entering following in the command window 2. Double check if you don't have the version already installed by entering following in the command window
```matlab ```matlab
>> PsychtoolboxVersion >> PsychtoolboxVersion
...@@ -15,10 +15,65 @@ This manual should help you to successfully install **Psychtoolbox** in your MAT ...@@ -15,10 +15,65 @@ This manual should help you to successfully install **Psychtoolbox** in your MAT
4. You need to install couple of things before Psychtoolbox itself: 4. You need to install couple of things before Psychtoolbox itself:
- Download and install GStreamer [here](https://gstreamer.freedesktop.org/download/). Download the **MSVC** version, not MinGW. If there are some problems with the installation, check this [website](http://psychtoolbox.org/docs/GStreamer) - Download and install **GStreamer** [here](https://gstreamer.freedesktop.org/download/). Download the **MSVC** version, not MinGW. If there are some problems with the installation, check this [website](http://psychtoolbox.org/docs/GStreamer)
- You'll also need to download Microsoft Runtime Libraries for MSVC 2015-2019 (you can find the link in section for windows installation in point 4., [here](http://psychtoolbox.org/download.html)) - You'll also need to download **Microsoft Runtime Libraries for MSVC 2015-2019** (you can find the link in section for windows installation in point 4., [here](http://psychtoolbox.org/download.html))
- Importantly, download the Psychtoolbox installer, also the official website, in section for windows installation, point 2., [here](http://psychtoolbox.org/download.html) - Importantly, download the Psychtoolbox installer, also the official website, in section for windows installation, point 2., [here](http://psychtoolbox.org/download.html). They advice to download it to your desktop, but I didn't and perhaps it's not so essential.
5. Go back to your Matlab, it should be still opened as administrator.
6. enter following:
```matlab
>> cd('into the folder where you downloaded DownloadPsychtoolbox.m to').
>> DownloadPsychtoolbox('C:\toolbox')
```
It's possible that at this point it already runs fine, it will just take a bit of time. If yes, then you just need to close and open Matlab again and verify if you have it installed by `PsychtoolboxVersion` command.
I have been asked if I want to delete the downloaded version, you can try to delete it first and if it's not working, you can choose not to. In that case you will be installing *beta* version. For me it works ok on the beta version.
 
In case you manage to download and install psychtoolbox, I suggest you to try running a basic demo from this [website](https://peterscarfe.com/totallyminimaldemo.html). I copied it below as well. In case you will have some synchronisation problems, just add at the beginning `Screen('Preference', 'SkipSyncTests', 1);`, otherwise copy this version. This should display a gray screen, that's it.
```matlab
% Clear the workspace and the screen
sca;
close all;
clearvars;
% Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% Get the screen numbers. This gives us a number for each of the screens
% attached to our computer.
screens = Screen('Screens');
% To draw we select the maximum of these numbers. So in a situation where we
% have two screens attached to our monitor we will draw to the external
% screen.
screenNumber = max(screens);
% Define black and white (white will be 1 and black 0). This is because
% in general luminace values are defined between 0 and 1 with 255 steps in
% between. All values in Psychtoolbox are defined between 0 and 1
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
% Do a simply calculation to calculate the luminance value for grey. This
% will be half the luminace values for white
grey = white / 2;
% Open an on screen window using PsychImaging and color it grey.
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
% Now we have drawn to the screen we wait for a keyboard button press (any
% key) to terminate the demo.
KbStrokeWait;
% Clear the screen.
sca;
```
... ...
......