-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwinsize.m
More file actions
36 lines (30 loc) · 982 Bytes
/
twinsize.m
File metadata and controls
36 lines (30 loc) · 982 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
% TWINSIZE Get/set window size for plotting
%
% Usage
% old_winsize = twinsize(new_winsize);
%
% Input
% new_winsize: The new window size, in the form of a pair of positive
% integers. Either dimension can also be set to 'Inf', indicating no
% limit to the window size. If empty, the window size is not changed
% (default empty).
%
% Output
% old_winsize: The old window size.
function old_winsize = twinsize(new_winsize)
if nargin < 1
new_winsize = [];
end
old_params = tparams();
if ~isempty(new_winsize)
if any(size(new_winsize) ~= [1 2]) || any(new_winsize < 1) || ...
any(abs(imag(new_winsize))>0) || ...
any(new_winsize ~= round(new_winsize))
error('Window size must be a pair of positive integers or Inf.');
end
new_params = old_params;
new_params.winsize = new_winsize;
tparams(new_params);
end
old_winsize = old_params.winsize;
end