Special matrix without for loop (vectorizing loop)
古いコメントを表示
Hi Guys
I am trying to improve a performance of a code which develops a special matrix. This matrix looks really simple but I couldn't find a solution to develop it without a for loop. This is a huge matrix and a for loop causes the code takes hours to run.
imagine a vector A = [ 1; 2; 3; 4; 5; 6; 7 ] I want to develop matrix B based on A. numbers are indexes not real numbers.
B = [1 2 3 4; 2 3 4 5; 3 4 5 6; 4 5 6 7 ]
your help is really appreciated.
Regards Mitch
採用された回答
その他の回答 (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!