Extracting rows from csv file which contain only certain text

7 views (last 30 days)
Hello, I have a csv file containing all the information I need. However, there are some rows I will not use in my data analysis. So I need to take out only certain rows I need, in order to have proper file to work with. The question is: If i want to extract all the rows which contain specific text in one of their columns, for instance 'Kitchen', and save only them to a new csv file, how do i do that?

Answers (1)

dpb on 6 Apr 2016
doc strfind
NB: there's no specific reason to make a new file unless you have other reasons besides doing the analysis; just read the data and select the desired subset in memory and do the analysis...certainly no need to
when can simply
Image Analyst
Image Analyst on 7 Apr 2016
Well, if you have a table variable, with some columns being strings and other columns being numbers, you can use writetable().
fprintf() is the most flexible though, but it take a few more steps than writetable.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!