Anyway to Pre-allocate Memory for Struct
조회 수: 1 (최근 30일)
이전 댓글 표시
Is there anyway to pre-allocate memory for a struct?
I have a
1x2 struct with 2 fields.
>> s = struct('Name',0,'Name2',0)
But, it comes up as a 1x1 struct.
댓글 수: 0
답변 (3개)
Walter Roberson
2015년 7월 17일
s = struct('Name',{0,0},'Name2',{0,0});
That is, use a cell array, one entry per struct member.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!