Azzera filtri
Azzera filtri

How to remove empty fields from a struct?

11 visualizzazioni (ultimi 30 giorni)
MSani
MSani il 27 Giu 2019
Risposto: Stephen23 il 28 Giu 2019
When I load a matlab file, I am getting a struct with fields as below:
a =
struct with fields:
bt: {[1×1 struct] [] [] [] [1×1 struct] [1×1 struct]}
I would like to delete the empty fields in between. How do I do that and save the file without changing any structure to it?
but I got this error:
Dot indexing is not supported for variables of this type.

Risposte (1)

Stephen23
Stephen23 il 28 Giu 2019
a.bt(cellfun('isempty',a.bt)) = []

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by