matlab - extract a single column from a matrix - stack overflow
DESCRIPTION
asddfTRANSCRIPT
-
01/04/2015 matlabExtractasinglecolumnfromamatrixStackOverflow
data:text/htmlcharset=utf8,%3Cdiv%20id%3D%22questionheader%22%20style%3D%22margin%3A%200px%200px%201em%3B%20padding%3A%205px 1/2
Kiran1,890 9 52 100
1Answer active oldest votes
1
1
IhaveamatrixgeneratedfromtheprogramwritteninMatlabsomethinglikethis:
'A''B''C''D''E'[4][1][0.9837][0.9928][0.9928][4][1][0.9995][0.9887][0.9995][4][1][0.9982][0.9995][0.9995][4][1][0.9959][0.9982][0.9887]
Iamtryingtoextractthecolumn 'D' withouttheheader'D'.
Icanputintoatemporaryvariableandthenextractthecolumndata.ButIamwondering,ifitcouldbedoneinasinglestep.
Thanks
matlab matrix
share improvethisquestion askedDec9'11at14:32
Canyoutellmethetypeofyourdata?E.g. whos(foo) alexplanationDec9'11at14:38
Itsacellmatrix Kiran Dec9'11at14:41
5
Ifyourvariableis data ,then data(2:end,4) shoulddoit.
Edit:
Forexample:
Extractasinglecolumnfromamatrix
addacomment
http://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix?answertab=oldest#tab-tophttp://stackoverflow.com/posts/8446968/edithttp://stackoverflow.com/users/276859/kiranhttp://stackoverflow.com/users/276859/kiranhttp://stackoverflow.com/q/8446968http://stackoverflow.com/users/1075864/alexplanationhttp://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix#http://stackoverflow.com/users/276859/kiranhttp://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix?answertab=active#tab-tophttp://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix?answertab=votes#tab-tophttp://stackoverflow.com/questions/tagged/matlabhttp://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix#comment10440884_8446968http://stackoverflow.com/questions/tagged/matrixhttp://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix#comment10440839_8446968http://stackoverflow.com/questions/8446968/extract-a-single-column-from-a-matrix -
01/04/2015 matlabExtractasinglecolumnfromamatrixStackOverflow
data:text/htmlcharset=utf8,%3Cdiv%20id%3D%22questionheader%22%20style%3D%22margin%3A%200px%200px%201em%3B%20padding%3A%205px 2/2
>>datadata='A''B''C''D''E'[4][1][0.9837][0.9928][0.9928][4][1][0.9995][0.9887][0.9995][4][1][0.9982][0.9995][0.9995][4][1][0.9959][0.9982][0.9887]>>data(2:end,4)%Extractthedataasacellarrayans=[0.9928][0.9887][0.9995][0.9982]>>cell2mat(data(2:end,4))%Converttoanumeric(typical)arrayans=0.99280.98870.99950.9982