Mercurial > hg > ishara
annotate general/arrutils/repmat_to.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 b=repmat_to(a,sz) |
samer@4 | 2 % repmat_to(a,sz): Like repmat, but sz is TARGET size, not repliction count |
samer@4 | 3 % |
samer@4 | 4 % repmat_to :: [[Size1]->A], Size2:dim -> [[Size2]->A]. |
samer@4 | 5 |
samer@4 | 6 % this will barf if any dimension of a is zero. |
samer@4 | 7 if any(sz==0) |
samer@4 | 8 b=zeros(sz); |
samer@4 | 9 else |
samer@4 | 10 sa=size1(a); |
samer@4 | 11 l=length(sz)-length(sa); |
samer@4 | 12 b=repmat(a,tosize(sz./[sa ones(1,l)])); |
samer@4 | 13 end |
samer@4 | 14 |