Subtracting mean from table column and creating new Column with solution

조회 수: 5 (최근 30일)
Tarun bhalla
Tarun bhalla 2020년 11월 28일
댓글: Tarun bhalla 2020년 11월 28일
Hey guys,
I'm new to matlab and stuck:
I have 30x10 table and I'm trying to do the following:
I'm attempting to take the values from column 5 and subract them from the mean of column 10.
I've already calculated the mean but I'm struggling to figure out how i can calculate the value of each individual row and subract it from the mean and add it a new column row in one function.
Would that be possible?
Thanks guys

답변 (2개)

Walter Roberson
Walter Roberson 2020년 11월 28일
t.NewColumn = mean(t{:,10}) - t{:,5};

M.Many
M.Many 2020년 11월 28일
%M = rand(30,10);
%T = array2table(M)
T{:,11}= mean(T{:,10})-T{:,5} % Replace T by your Table
  댓글 수: 3
M.Many
M.Many 2020년 11월 28일
True, thanks for the additional note.
Tarun bhalla
Tarun bhalla 2020년 11월 28일
thanks for the help, it worked! thnakyou

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by