필터 지우기
필터 지우기

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 CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by