MATLAB Answers

pre allocating triple loops

1 view (last 30 days)
hi,
how to pre-allocate this:
for ii = 1:numel(L);
for jj=1:numel(L);
for kk=1:45;
c=cross(L1(ii,:),a{jj}(kk,:));
end
end
end

  0 Comments

Sign in to comment.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 11 Jun 2020
n = numel(L);
c = cell(n,n,45);
for ii = 1:n
for jj = 1:n
for kk = 1:45
c{ii,jj,kk} = cross(L1(ii,:),a{jj}(kk,:));
end
end
end

  0 Comments

Sign in to comment.

More Answers (0)


Translated by