I need to fit with the fourier function every successive row of the matrix avoiding to use for
loop. I tried to use a cell array but have no idea how to use it with fit.
My program is
I=imread('test.tif','tif');
I=double(I);
nat=num2cell(I,1);
wy_I=cellfun(@size,nat, 'UniformOutput', false);
we_I=cellfun(@(x)1:x(1), wy_I, 'UniformOutput', false);
wyn=cellfun(@(x,y)fit(x',y,'fourier1'), we_I, nat);
It gives ??? Error using ==> cellfun cfit type is not currently implemented.
probably cell array is not a solution for this problem.
How to solve this problem?
Thanks
Update
wyn=cellfun(@(x,y)fit(x',y,'fourier1'), we_I, nat, 'UniformOutput',false);
works without errors but wyn have only empty cells
I test it for one rowj=cell2mat(we_I(1,1))
开发者_JAVA百科k=cell2mat(nat(1,1))
z=fit(j',k,'fourier1')
and z
contains good values for model
The FIT function returns an object of type cfit
in this example. The error would appear to suggest that CELLFUN is unable to collect these objects into an array of type cfit
to return as an output. I would instead try returning a cell array of cfit
objects by adding 'UniformOutput',false
to the last line as well.
精彩评论