How can I extract data with respect to certain non numeric values

8 次查看(过去 30 天)
I have a csv file, which have numeric and non numeric columns. e.g the first, second and fourth column has numbers and the third column has letters i.e C,S,CA. I have imported the file and sorted the third (non-numeric) column so all the C, CA and S values are listed together. How can I extract rows of data that are associated with 'CA'? Thanks

采纳的回答

Image Analyst
Image Analyst 2016-4-17
Use readtable() to read your data into a table. Then use ismember() to find out which rows have CA in them, then use that to filter the rows. If you don't understand, then attach your data (csv file).
  4 个评论
shellmcg
shellmcg 2016-4-18
Thanks Image Analysis. I am getting an error with readtable function 'Undefined function 'readtable' for input arguments of type 'char'. I have loaded my data but I seem to be missing the column names so if I wanted CAs out of column 2 could I use col2=t.(:,2) instead of col2 = t.atom_types? Cheers

请先登录,再进行评论。

更多回答(1 个)

Yuebin Zhou
Yuebin Zhou 2016-4-15

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by