嗨,我有以下内容:
b = cellfun(@(x) sum(cross(u{1},x)),r,'UniformOutput',false);
我想省略总和并更改为:
b = cellfun(@(x) cross(u{1},x),r,'UniformOutput',false);
但是我得到的错误:
??? Error using ==> reshape
To RESHAPE the number of elements must not change.
Error in ==> cellcross at 4
bres = reshape(bmat,size(grid')); %reshape the get columns of bfield vectors in x y z format
原因是我不认为我在正确的地方求和。我想做 sum(cross(u{1},r{1}))....sum(cross(u{1},r{n})) 但结果似乎没有这样做。