Bob's pick this week is读取by Peder Axensten. Jiro recently highlightedtextscantool这可以使将文本数据导入MATLAB变得更加容易。但是您可能遇到了使您感到沮丧的数据,textscan. I recently analyzed some data I got from a web source as a CSV file. The comma seperated values had single quotes around them all - both string and numeric types. Here's a sample.
typeSampleData.csv
“詹姆斯·墨菲”、“471”“John Doe, Jr .)”,“44”' Bill O 'Brien','127'
So there are really three kinds of delimiters per line.
在第一个值之前引用的引用
quote-comma-quote between values
a trailing quote after the last value
If you've been doing much text data importing into MATLAB than you probably know thattextscan很好,但不能正确解析此文件。
In a word - wow! The embedded comma was no problem. Moreover, first column values are strings and second column values are numbers. In another word - sweet. What's your favorite trick or tool for reading particularly nasty data files? Tell us about it这里.
注释
To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.