~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychOneliners/SetResolution.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
% 6/7/02  dgp Hz value of NaN matches NaN.
39
39
% 9/23/07 mk  Adapted for Psychtoolbox-3.
40
40
 
41
 
if nargin<2 | nargin>5
 
41
if nargin<2 || nargin>5
42
42
        error(sprintf('%s\n%s','USAGE: oldRes=SetResolution(screenNumber,width,height,[hz],[pixelSize])',...
43
43
                           '           oldRes=SetResolution(screenNumber,res)'));
44
44
end
45
45
 
46
 
if screenNumber<0 | screenNumber>max(Screen('Screens'))
 
46
if screenNumber<0 || screenNumber>max(Screen('Screens'))
47
47
        error(sprintf('Invalid screenNumber %d.',screenNumber));
48
48
end
49
49
 
61
61
        hz=oldRes.hz;
62
62
end
63
63
 
64
 
if nargin==2 & isa(width,'struct')
 
64
if nargin==2 && isa(width,'struct')
65
65
        res=width;
66
66
        if isfield(res,'width')
67
67
                width=res.width;
77
77
        end
78
78
end
79
79
 
80
 
if ~exist('height','var')  | isempty(height) | ~isfinite(height)
 
80
if ~exist('height','var')  || isempty(height) || ~isfinite(height)
81
81
        error('height (in pixels) must be specified.');
82
82
end
83
83
 
84
 
if ~exist('width','var') | isempty(width) | ~isfinite(width)
 
84
if ~exist('width','var') || isempty(width) || ~isfinite(width)
85
85
        error('width (in pixels) must be specified.');
86
86
end
87
87
 
97
97
end
98
98
 
99
99
nres = res(resIndex(1));
100
 
if isempty(pixelSize) | ~isfinite(pixelSize)
 
100
if isempty(pixelSize) || ~isfinite(pixelSize)
101
101
    nres.pixelSize = [];
102
102
else
103
103
    nres.pixelSize = pixelSize;