pre allocating triple loops

2 visualizaciones (últimos 30 días)
Oday Shahadh
Oday Shahadh el 10 de Jun. de 2020
Respondida: Stephen23 el 11 de Jun. de 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

Respuesta aceptada

Stephen23
Stephen23 el 11 de Jun. de 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

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by