Filter löschen
Filter löschen

pre allocating triple loops

3 Ansichten (letzte 30 Tage)
Oday Shahadh
Oday Shahadh am 10 Jun. 2020
Beantwortet: Stephen23 am 11 Jun. 2020
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

Akzeptierte Antwort

Stephen23
Stephen23 am 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

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by