Mercurial > hg > ishara
annotate general/arrutils/arrset.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 x=arrset(x,i,z) |
samer@4 | 2 % arrset - set elements of array and return result |
samer@4 | 3 % |
samer@4 | 4 % arrset :: |
samer@4 | 5 % [(S:[[1,E]])->R] ~'E-dim array of size S', |
samer@4 | 6 % { K:[E] -> [D->[S(K)]] } ~'cell array of E index arrays', |
samer@4 | 7 % [D->R] ~'data to write' |
samer@4 | 8 % -> [S->R]. |
samer@4 | 9 % |
samer@4 | 10 % Linear indexing version: |
samer@4 | 11 % |
samer@4 | 12 % arrset :: |
samer@4 | 13 % [(S:[[1,E]])->R] ~'E-dim array of size S', |
samer@4 | 14 % [D->[prod(S)]] ~'linear indices between 1 and prod(S)', |
samer@4 | 15 % [D->R] ~'data to write' |
samer@4 | 16 % -> [S->R]. |
samer@4 | 17 if iscell(i), x(i{:})=z; |
samer@4 | 18 else x(i)=z; end |
samer@4 | 19 |