0001 function tilefigs(tile,border)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 maxpos = get (0,'screensize');
0014 maxpos(4) = maxpos(4) - 25;
0015 hands = get (0,'Children');
0016 hands = sort(hands);
0017 numfigs = size(hands,1);
0018
0019
0020 maxfigs = 100;
0021
0022
0023 if (numfigs>maxfigs)
0024 disp([' More than ' num2str(maxfigs) ' figures ... get serious pal'])
0025 return
0026 end
0027
0028
0029 if nargin == 0
0030 maxfactor = sqrt(maxfigs);
0031 sq = [2:maxfactor].^2;
0032 sq = sq(find(sq>=numfigs));
0033 gridsize = sq(1);
0034 nrows = sqrt(gridsize);
0035 ncols = nrows;
0036 elseif nargin > 0
0037 nrows = tile(1);
0038 ncols = tile(2);
0039 if numfigs > nrows*ncols
0040 disp ([' requested tile size too small for ' ...
0041 num2str(numfigs) ' open figures '])
0042 return
0043 end
0044 end
0045 if nargin < 2
0046 border = 0;
0047 else
0048 maxpos(3) = maxpos(3) - 2*border;
0049 maxpos(4) = maxpos(4) - 2*border;
0050 end
0051 xlen = fix(maxpos(3)/ncols) - 30;
0052 ylen = fix(maxpos(4)/nrows) - 45;
0053
0054
0055
0056
0057 pnum=0;
0058 for iy = 1:nrows
0059 ypos = maxpos(4) - fix((iy)*maxpos(4)/nrows) + border +25;
0060 for ix = 1:ncols
0061 xpos = fix((ix-1)*maxpos(3)/ncols + 1) + border+7;
0062 pnum = pnum+1;
0063 if (pnum>numfigs)
0064 break
0065 else
0066 figure(hands(pnum))
0067 set(hands(pnum),'Position',[ xpos ypos xlen ylen ]);
0068 end
0069 end
0070 end
0071 return
0072
0073
0074