メインコンテンツ

table2cell

テーブルの cell 配列への変換

説明

C = table2cell(T) は、table または timetable T を cell 配列 C に変換します。T の各変数は C のセルの 1 つの列になります。

出力 C は、T.Properties のテーブル プロパティを含みません。

  • T が行名をもつ table である場合、C は行名を含みません。

  • T が timetable の場合、C は行時間を含みません。

すべて折りたたむ

5 つの行と 3 つの変数をもつ table T を作成します。

T = table(categorical(["Y";"Y";"N";"N";"N"]),[38;43;38;40;49], ...
[124 93;109 77; 125 83; 117 75; 122 80], ...
VariableNames=["Smoker" "Age" "BloodPressure"], ...
RowNames=["Chang" "Brown" "Ruiz" "Lee" "Garcia"])
T=5×3 table
              Smoker    Age    BloodPressure
              ______    ___    _____________

    Chang       Y       38      124     93  
    Brown       Y       43      109     77  
    Ruiz        N       38      125     83  
    Lee         N       40      117     75  
    Garcia      N       49      122     80  

T を cell 配列に変換します。

C = table2cell(T)
C=5×3 cell array
    {[Y]}    {[38]}    {[124 93]}
    {[Y]}    {[43]}    {[109 77]}
    {[N]}    {[38]}    {[125 83]}
    {[N]}    {[40]}    {[117 75]}
    {[N]}    {[49]}    {[122 80]}

table プロパティ T.Properties.VariableNamesC と垂直方向に連結して、cell 配列の列見出しを含めます。

[T.Properties.VariableNames;C]
ans=6×3 cell array
    {'Smoker'}    {'Age'}    {'BloodPressure'}
    {[Y     ]}    {[ 38]}    {[       124 93]}
    {[Y     ]}    {[ 43]}    {[       109 77]}
    {[N     ]}    {[ 38]}    {[       125 83]}
    {[N     ]}    {[ 40]}    {[       117 75]}
    {[N     ]}    {[ 49]}    {[       122 80]}

T.Properties.VariableNames は、変数名が string 配列からあらかじめ割り当てられていた場合でも、変数名を文字ベクトルの cell 配列として保存します。

入力引数

すべて折りたたむ

入力 table。table または timetable として指定します。

Tmn 列の table または timetable である場合、Cmn 列の cell 配列です。

出力引数

すべて折りたたむ

出力 cell 配列。

拡張機能

すべて展開する

GPU コード生成
GPU Coder™ を使用して NVIDIA® GPU のための CUDA® コードを生成します。

スレッドベースの環境
MATLAB® の backgroundPool を使用してバックグラウンドでコードを実行するか、Parallel Computing Toolbox™ の ThreadPool を使用してコードを高速化します。

バージョン履歴

R2013b で導入