Split a matrix in two matrix according a criterion
Afficher commentaires plus anciens
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 !
Réponses (1)
Jos (10584)
le 28 Fév 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)
Catégories
En savoir plus sur ANOVA dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!