Watch this Author's files
I suggest a couple of minor changes :
1) Insert the following two lines after line 50 to get reasonable default values :
if (nargin < 3) winSize = 3; end; if (nargin < 2) ord = 'med'; end;
2) Replace M = feature('memstats'); (which only works on Windows) with
try M = feature('memstats'); catch e M = 10^28; % or however many bytes of free space you figure your machine will have end;
To solve the mex compilation error :
on OSX, add the following as line 3 of diffusion_scheme_3D_novel_getUpdate.c :
#include "string.h"
and re-run the mex script
This code is needed as well (append on to end of fftInterpolate.m file):
function subData = subRange(data,rng)
if (isempty(rng)) subData = data; return; end;
sz = size(data); dim = length(sz);
lo = rng(:,1)'; hi = rng(:,2)';
if (length(lo) ~= dim || length(hi) ~= dim) error('subRange :: dimension mismatch'); end;
% replace zeros with lower/upper limit for i=1:dim if (lo(i) == 0) lo(i) = 1; end; if (hi(i) == 0) hi(i) = sz(i); end; end;
if (any(lo<1) | any(hi > sz)) error('subRange :: sub-range out of bounds'); end;
switch (dim) case 1, subData = data(lo(1):hi(1)); case 2, subData = data(lo(1):hi(1),... lo(2):hi(2)); case 3, subData = data(lo(1):hi(1),... lo(2):hi(2),... lo(3):hi(3)); case 4, subData = data(lo(1):hi(1),... lo(2):hi(2),... lo(3):hi(3),... lo(4):hi(4)); case 5, subData = data(lo(1):hi(1),... lo(2):hi(2),...[] lo(3):hi(3),... lo(4):hi(4),... lo(5):hi(5)); otherwise, % generate string and use eval str = 'subData = data('; for i=1:dim str = [str 'lo(' num2str(i) '):hi(' num2str(i) ')']; if (i~=dim) str = [str ',']; else str = [str ');']; end; end; eval(str); end; return;
Can someone explain me how do I work with these functions? It should not have a GUI file?
This fails with ...
??? Undefined function or method 'odd' for input arguments of type 'double'.
Error in ==> fftInterpolate at 61 centeru = floor(newsz/2)+1+odd(newsz);
Dear author
please find rng = [ceil(newsz/2)-ceil(sz/2)+1;ceil(newsz/2)-ceil(sz/2)+sz]';
and replace it with rng = [ceil(newsz/2)-floor(sz/2)+1;ceil(newsz/2)-floor(sz/2)+sz]';
then the code also works with odd dimesions.
Matthias Wurm
Contact us at files@mathworks.com