annotate general/arrutils/promote.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
e44f49929e56 |
children |
|
rev |
line source |
samer@4
|
1 function varargout=promote(varargin)
|
samer@4
|
2 % promote - repmats all args to be the same size
|
samer@4
|
3 %
|
samer@4
|
4 % promote :: var {I:[N]->[[Size(I)]->A]} ~'variable argument list of arrays'
|
samer@4
|
5 % -> var {I:[[N]]->[[MSize]->A]} ~'all arrays of same size'.
|
samer@4
|
6 %
|
samer@4
|
7 % Target size is the maximum along each dimensions of all the input sizes.
|
samer@4
|
8
|
samer@4
|
9 maxdims=max(cellcat(1,cellmap(@numdims,varargin)));
|
samer@4
|
10 target=max(cellcat(1,cellmap(@(x)pad1s(maxdims,size1(x)),varargin)),[],1);
|
samer@4
|
11 varargout=cellmap(@(x)repmat_to(x,tosize(target)),varargin);
|
samer@4
|
12
|
samer@4
|
13
|
samer@4
|
14
|