niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | function H = subfigure(m, n, p) |
| 2 | % |
| 3 | % H = SUBFIGURE(m, n, p) |
| 4 | % |
| 5 | % Create a new figure window and adjust position and size such that it will |
| 6 | % become the p-th tile in an m-by-n matrix of windows. (The interpretation of |
| 7 | % m, n, and p is the same as for SUBPLOT. |
| 8 | % |
| 9 | % Henrik Lundin, 2009-01-19 |
| 10 | % |
| 11 | |
| 12 | |
| 13 | h = figure; |
| 14 | |
| 15 | [j, i] = ind2sub([n m], p); |
| 16 | scrsz = get(0,'ScreenSize'); % get screen size |
| 17 | %scrsz = [1, 1, 1600, 1200]; |
| 18 | |
| 19 | taskbarSize = 58; |
| 20 | windowbarSize = 68; |
| 21 | windowBorder = 4; |
| 22 | |
| 23 | scrsz(2) = scrsz(2) + taskbarSize; |
| 24 | scrsz(4) = scrsz(4) - taskbarSize; |
| 25 | |
| 26 | set(h, 'position', [(j-1)/n * scrsz(3) + scrsz(1) + windowBorder,... |
| 27 | (m-i)/m * scrsz(4) + scrsz(2) + windowBorder, ... |
| 28 | scrsz(3)/n - (windowBorder + windowBorder),... |
| 29 | scrsz(4)/m - (windowbarSize + windowBorder + windowBorder)]); |
| 30 | |