How do I initialize an array of unknown dimension?
古いコメントを表示
I have a vector whose length is not known apriori. The programs gives a warning with red wiggles underneath indicating that the size of the array varies each loop and preallocating the size is a good idea. But how do I do that since I do not know what is the size going to be.
1 件のコメント
Geoff Hayes
2018 年 3 月 12 日
Pappu - do you have an idea of the size of the array? You could pre-allocate to some large size and then reduce the size of the array at the end if there are any "unused" elements.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!