How to remove an element from a structure array using matfile handler
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I am using following piece of code to remove an element from a structure array, but its not working please help
MatfileHandler.StructureArray(index,:)=[];
since the above wasn't working thus I used following statements.
AllElements = MatfileHandler.StructureArray; %loaded all elements in AllElements
AllElements(index,:)=[]; %Removed the required element
MatfileHandler.StructureArray = AllElements; %Resaving the AllElements to Actual Matfile
the above code works fine but it takes too much time especially when the size of structure is big. Please help me how to reduce time or remove element by using matfile handler, thanks.
댓글 수: 3
답변 (1개)
Guillaume
2018년 7월 27일
As documented in the limitations of matfile, it does not let you index into the fields of a structure. Therefore the only way is to do what you have done: load the whole structure, edit the structure and write it back.
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!