我需要在矩阵的每一行都使用傅立叶函数,避免使用for
循环。我尝试使用单元格数组,但不知道如何配合使用它。我的程序是
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);
它给出的??? Error using ==> cellfun cfit type is not currently implemented.
可能单元格数组不是这个问题的解决方案。如何解决这个问题呢?谢谢
更新
wyn=cellfun(@(x,y)fit(x',y,'fourier1'), we_I, nat, 'UniformOutput',false);
工作没有错误,但 wyn 只有空单元格
我测试了一行
j=cell2mat(we_I(1,1))
k=cell2mat(nat(1,1))
z=fit(j',k,'fourier1')
并z
包含模型的好值
我在 cellfun 中的语法有问题,但不知道是什么