フィルターのクリア

How can I add a column with labelining in a matrix

2 ビュー (過去 30 日間)
Sazid Hasan
Sazid Hasan 2021 年 8 月 27 日
コメント済み: Sazid Hasan 2021 年 8 月 27 日
I have data matrix. I have to add label column with same name Before in the matrix. How I can add this labeling?

採用された回答

Chunru
Chunru 2021 年 8 月 27 日
% Create a table with some data
a = (1:10)'; b=rand(10, 1); c=randi([1,100], 10, 1);
T = table(a, b, c)
T = 10×3 table
a b c __ _______ __ 1 0.31924 57 2 0.41572 9 3 0.33329 31 4 0.52433 42 5 0.60832 6 6 0.56471 1 7 0.19825 51 8 0.20861 67 9 0.75822 19 10 0.8956 96
% Now add the label
T.label = repmat("Before", 10, 1);
T = T(:, [end 1:end-1])
T = 10×4 table
label a b c ________ __ _______ __ "Before" 1 0.31924 57 "Before" 2 0.41572 9 "Before" 3 0.33329 31 "Before" 4 0.52433 42 "Before" 5 0.60832 6 "Before" 6 0.56471 1 "Before" 7 0.19825 51 "Before" 8 0.20861 67 "Before" 9 0.75822 19 "Before" 10 0.8956 96
  1 件のコメント
Sazid Hasan
Sazid Hasan 2021 年 8 月 27 日
Thank you very much. If I split label like before and after 5 for before and 5 for after how it will be done? As i try define the size, it not working.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by