reshape loop resulted cell array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Oday Shahadh
am 19 Jun. 2020
Kommentiert: Oday Shahadh
am 19 Jun. 2020
hi, the script below is supposed to result a (n,3) vector, what I got is (180,60) vector, kindley help
c1 = cell(numel(a11),1);
for ii = 1:length(L1);
for kk = 1:length(a11);
c1{ii,kk}=cross(L1(ii,:),a11(kk,:));
end
end
2 Kommentare
James Tursa
am 19 Jun. 2020
It is unclear what you really want as an answer. The current code creates a cell array of all possible combinations of cross products of vectors from L1 and a11. This is what you want? But you want the result to be a matrix that is n x 3 instead of a cell array?
Akzeptierte Antwort
James Tursa
am 19 Jun. 2020
result = cell2mat(c1(:))';
3 Kommentare
James Tursa
am 19 Jun. 2020
Pre-allocate differently:
c1 = cell(length(L1),length(a11));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!