mfbox_transgrid.m

来自「toolbox for spm 5 for data, model free a」· M 代码 · 共 34 行

M
34
字号
function newdata=mfbox_transgrid(oldgrid,olddata,newgrid)% newdata=mfbox_transgrid(oldgrid,olddata,newgrid)%% Copyright by Peter Gruber% Signal Processing & Information Theory group% Institute of Biophysics, University of Regensburg, Germany% Homepage: http://research.fabian.theis.name%           http://www-aglang.uni-regensburg.de%% This file is free software, subject to the % GNU GENERAL PUBLIC LICENSE, see gpl.txt%[r,s] = min(repmat(sum(d.^2,2),1,size(c,1))-2*d*c'+repmat(sum(c.^2,2)',size(d,1),1));% very quick, very dirty[m,v,e] = mfbox_voronoimap(newgrid',oldgrid');[n,w,f] = mfbox_voronoimap(oldgrid',newgrid');newdata = olddata(m);if (length(unique(n))<length(n)) %average over candidates (TODO replace by accumarray)    for i=1:length(newdata)        p = find(n==i);        if (length(p)>1)            t = e{i};            if (min(t(:))>0)                t = 1./sqrt(t(:))                newdata(i) = sum(olddata(p).*t)/sum(t(:));            end        end    endendreturn

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?