annotate general/arrutils/mzip.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 % mzip - Apply array to multiple index arrays
|
samer@4
|
2 %
|
samer@4
|
3 % mzip :: [[N,M]->D], [[L]->[N]], [[L]->[M]] -> [[L]->D].
|
samer@4
|
4 %
|
samer@4
|
5 % The name mzip is meant to suggest Matrix or Multiple Zip,
|
samer@4
|
6 % with zip referring to the functional programming sort of
|
samer@4
|
7 % zip where you can apply a function of N arguments to N
|
samer@4
|
8 % lists of arguments and get a list of return values.
|
samer@4
|
9 % eg, mzip(x,[2 4 1],[3 2 2]) = [x(2,3) x(4,2) x(1,2)].
|
samer@4
|
10
|
samer@4
|
11 function B=mzip(A,varargin), B=A(sub2ind(size(A),varargin{:}));
|
samer@4
|
12
|
samer@4
|
13
|