How to remove an element from a structure array using matfile handler
Mostrar comentarios más antiguos
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 comentarios
Image Analyst
el 27 de Jul. de 2018
Editada: Image Analyst
el 27 de Jul. de 2018
What is a matfile handler? I can't seem to find it in the help. Is it a class that you wrote?
And how much time is it taking now. And how gigantic is your structure array? Like how many elements and gigabytes?
Abdurrehman
el 27 de Jul. de 2018
Abdurrehman
el 28 de Jul. de 2018
Respuestas (1)
Guillaume
el 27 de Jul. de 2018
0 votos
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.
1 comentario
Abdurrehman
el 28 de Jul. de 2018
Categorías
Más información sobre Workspace Variables and MAT Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!