필터 지우기
필터 지우기

How can I create new variables based on groups?

조회 수: 2 (최근 30일)
Hannah_Mad
Hannah_Mad 2020년 4월 27일
댓글: Hannah_Mad 2020년 4월 29일
Hello everyone,
I want to create new variables in order to perform a t-test based on the group membership of my subjects. I have this code here:
clearvars
close all
filepath = ['filepath'];
T =readtable('filename');
G = findgroups(T(:,1))
if G == 1
X = T(:,:)
else G == 2
Y = T(:,:)
end
I am encountering the following problem: It does not work. I will only get table T again for Y and not what I want, two entirely seperate tables based on whether a subject is in group 1 or 2. Any help or tips would be appreciated.
Thank you
  댓글 수: 18
Walter Roberson
Walter Roberson 2020년 4월 28일
What is class(F{:,1}) ? What is size(F{:,1}) ? What is size(G) ?
Hannah_Mad
Hannah_Mad 2020년 4월 29일
Hello Walter,
I got the following:
class(F{:,1}) : double
size(F{:,1}) 38 1
size(G) 38 1
I think that is alright, isn't it?
Thank you,
Hannah

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by