The output is not preallocated and grows inside the loop: M-LINT!!!
This will do the same thing faster (with preallocating output):
[r,c]=size(A);
[rr cc] = meshgrid(1:r,1:c);
D = zeros(r,c);
for ii = 1:numel(A)
D(ii) = det(A(~(rr(ii)==1:r),~(cc(ii)==1:c)));
end
Ab = (-1).^(rr+cc).*D';
The output is not preallocated and grows inside the loop: M-LINT!!!
This will do the same thing faster (with preallocating output):
[r,c]=size(A);
[rr cc] = meshgrid(1:r,1:c);
D = zeros(r,c);
for ii = 1:numel(A)
D(ii) = det(A(~(rr(ii)==1:r),~(cc(ii)==1:c)));
end
Ab = (-1).^(rr+cc).*D';