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!