Split a matrix in two matrix according a criterion
Mostrar comentarios más antiguos
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 !
Respuestas (1)
Jos (10584)
el 28 de Feb. de 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 comentario
Remi Chaussenot
el 28 de Feb. de 2015
Categorías
Más información sobre ANOVA en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!