selectfields: Select specified field names from a struct

バージョン 2.0.0.0 (4.38 KB) 作成者: Bill Whiten
Selects fields listed in a cell array from a struct
ダウンロード: 94
更新 2019/3/13

ライセンスの表示

Selects fields listed in a cell array from a struct. Optional third
argument suppresses error message if struct does not contain
given field.
Exmples:
struct2=selectfields(struct1,{list of field names})
Moves field names and corresponding field content from struct1 to
struct2.

struct2=selectfields(struct1,{list of field names},true)
Moves field names and corresponding field content from struct1 to
struct2 if field name exists in struct1. Error messages for
missing field nanes are suppressed

See also renamefields

See doc selectfields

引用

Bill Whiten (2024). selectfields: Select specified field names from a struct (https://www.mathworks.com/matlabcentral/fileexchange/63774-selectfields-select-specified-field-names-from-a-struct), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2017a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersStructures についてさらに検索
タグ タグを追加
謝辞

ヒントを得たファイル: renamefields: Rename some field names in a struct

ヒントを与えたファイル: Optional function arguments

Community Treasure Hunt

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

Start Hunting!

selectfieldsfldr

バージョン 公開済み リリース ノート
2.0.0.0

Updated as suggested by Stephen

1.2.0.0

Reloaded, thanks Stephen

1.1.0.0

Updated to include struct arrays, thanks to Jos & Stephen.
still includes error messages

1.0.0.0