Split a matrix in two matrix according a criterion
Show older comments
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 !
Answers (1)
Jos (10584)
on 28 Feb 2015
% 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)
1 Comment
Remi Chaussenot
on 28 Feb 2015
Categories
Find more on ANOVA in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!