- how delete empty fields in a struct
- How to remove empty struct fields [ ] from a group a struct fields ?
構造体から欠損データを削除する
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
下記のような空([])の値を含む構造体Aから、空のフィールドを取り除いた構造体Bを作成したいです。
どのようにすれば、よろしいでしょうか
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/790939/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/790944/image.png)
0 commentaires
Réponses (1)
Atsushi Ueno
le 5 Nov 2021
Modifié(e) : Atsushi Ueno
le 5 Nov 2021
【類似の質問】
A = struct('a',"abc",'b',"def",'c',[])
fn = fieldnames(A);
B = rmfield(A, fn(cellfun(@(c) isempty(A.(c)), fn)))
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!