Avoid loops with matrices.
古いコメントを表示
Could anyone help me with avoiding loops at these situations (if it is possible):
a = [1 2 3 4 5 4 3 2 1 2 3 4 5];
b = [2 3 4 5 4 3 2 1 2 3 4 5 4];
q = 1:13;
c = cell(5,5);
for i = 1:numel(a)
c{a(i), b(i)} = [c{a(i), b(i)}, q(i)];
end
also
for i = 1:numel(a)
c{a(i), b(i)} = unique(c{a(i), b(i)})'
end
For me it is necessary to save every sec! Tnx!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!