pre allocating vector for loop

1 visualización (últimos 30 días)
Oday Shahadh
Oday Shahadh el 12 de Jun. de 2020
Comentada: Oday Shahadh el 12 de Jun. de 2020
Can any one tell how to pre allocate c1?
thanks
for ii = 1:length(a11);
c1=cross(L1(1,:),a11(ii,:));
end

Respuesta aceptada

madhan ravi
madhan ravi el 12 de Jun. de 2020
c1 = cell(numel(a11),1); % before loop use numel instead of length
c1{ii} = ... inside loop
  5 comentarios
Oday Shahadh
Oday Shahadh el 12 de Jun. de 2020
Then Madhani how can I switch all these cell arrays to ( n,3) matrix
Oday Shahadh
Oday Shahadh el 12 de Jun. de 2020
cell2mat

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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