Azzera filtri
Azzera filtri

pre allocating vector for loop

2 visualizzazioni (ultimi 30 giorni)
Oday Shahadh
Oday Shahadh il 12 Giu 2020
Commentato: Oday Shahadh il 12 Giu 2020
Can any one tell how to pre allocate c1?
thanks
for ii = 1:length(a11);
c1=cross(L1(1,:),a11(ii,:));
end

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by