Filter löschen
Filter löschen

pre allocating vector for loop

1 Ansicht (letzte 30 Tage)
Oday Shahadh
Oday Shahadh am 12 Jun. 2020
Kommentiert: Oday Shahadh am 12 Jun. 2020
Can any one tell how to pre allocate c1?
thanks
for ii = 1:length(a11);
c1=cross(L1(1,:),a11(ii,:));
end

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing 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