ドキュメンテーションヘルプ センター
最新のリリースでは、このページがまだ翻訳されていません。 このページの最新版は英語でご覧になれます。
構造体を cell 配列に変換
C = struct2cell(S)
例
C = struct2cell(S) は構造体を cell 配列に変換します。cell 配列 C には、S のフィールドからコピーされた値が含まれます。
C
S
関数 struct2cell はフィールド名を返しません。cell 配列でフィールド名を返すには、関数 fieldnames を使用します。
struct2cell
fieldnames
すべて折りたたむ
構造体を作成します。
S.x = linspace(0,2*pi); S.y = sin(S.x); S.title = 'y = sin(x)'
S = struct with fields: x: [1x100 double] y: [1x100 double] title: 'y = sin(x)'
S を cell 配列に変換します。
C=3×1 cell array {1x100 double} {1x100 double} {'y = sin(x)'}
cell 配列にはフィールド名は含まれません。cell 配列でフィールド名を返すには、関数 fieldnames を使用します。fieldnames と struct2cell はフィールド名と値を同じ順序で返します。
fields = fieldnames(S)
fields = 3x1 cell {'x' } {'y' } {'title'}
入力構造体配列。S は任意のサイズの構造体配列にすることができます。S が、p 個のフィールドをもつ m 行 n 列の構造体配列の場合、C は p x m x n の cell 配列になります。
p
m
n
使用上の注意事項および制限事項:
S が構造体の可変サイズの配列である場合、すべての要素の各フィールドのタイプは同じでなければなりません。異種混合 cell 配列を可変サイズにすることはできません。
構造体 S の固定サイズの配列で、struct2cell が S を同種の cell 配列に変換できない場合、出力 cell 配列は異種混合になります。異種混合の出力 cell 配列は、最大 1024 の要素をもつことができます。
この関数は分散配列を完全にサポートしています。詳細については、分散配列を使用した MATLAB 関数の実行 (Parallel Computing Toolbox)を参照してください。
cell | cell2struct | fieldnames | iscell | isstruct | struct | struct2table | table2cell
cell
cell2struct
iscell
isstruct
struct
struct2table
table2cell
この例の変更されたバージョンがシステム上にあります。代わりにこのバージョンを開きますか?
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office