構造体から欠損データを削除する
이전 댓글 표시
下記のような空([])の値を含む構造体Aから、空のフィールドを取り除いた構造体Bを作成したいです。
どのようにすれば、よろしいでしょうか

답변 (1개)
【類似の質問】
- how delete empty fields in a struct
- How to remove empty struct fields [ ] from a group a struct fields ?
A = struct('a',"abc",'b',"def",'c',[])
fn = fieldnames(A);
B = rmfield(A, fn(cellfun(@(c) isempty(A.(c)), fn)))
카테고리
도움말 센터 및 File Exchange에서 構造体에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!