Split a matrix in two matrix according a criterion
이전 댓글 표시
Hello,
I have a text-matrix :
genotype =
'WT'
'WT'
...
'KO'
'KO'
...
(format x*1 cell)
And, a number-matrix :
var =
60
80
..
50
60
..
(format : x*1 double)
It is good for using anova1 :
r = anova1(var, genotype)
But, for further analysis and plotting, i need another format :
wt_ var =
60
80
...
and
ko_var =
50
60
...
How can i generate wt_var and ko_var using genotype and var ?
Thanks !
답변 (1개)
Jos (10584)
2015년 2월 28일
% sample data
G = {'wt','wt','ko','ko','wt'}
V = [10 20 30 40 50]
% transform G into numbers, there are other ways
[tf, idx] = ismember(G,{'wt','ko'})
% select
V_wt = V(idx==1)
V_ko = V(idx==2)
카테고리
도움말 센터 및 File Exchange에서 ANOVA에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!