csvreader
Overview:
------------
csvreader is a robust comma separated value (CSV) function for MATLAB. The built-in CSV reading in MATLAB is either for numeric data only (csvread) or does not handle complex strings (dataset). There is no built-in MATLAB function that handles reading CSV files that contain quoted strings that may contain commas. For example, the following CSV will be problematic for MATLAB to read in correctly:
Joe Demo,"2 Demo Street, Demoville, Australia. 2615",joe@someaddress.com
Jim Sample,"3 Sample Street, Sampleville, Australia. 2615",jim@sample.com
Jack Example,"1 Example Street, Exampleville, Australia. 2615",jack@example.com
The second entry of each line is an address that contains a comma. Non-robust CSV parsers will fail to put the entire address in the same cell. Further, csvreader will accept quoted strings that contain line breaks.
For help and example usage, type "help csvreader" from the MATLAB command window.
Installation:
------------
The csvreader function uses a Java Archive (JAR) library from the opencsv project. In order to be called from within MATLAB, the opencsv JAR must be placed on MATLAB's Java class path. For more information on the MATLAB java class path see http://www.mathworks.com/help/matlab/matlab_external/bringing-java-classes-and-methods-into-matlab-workspace.html
To install the JAR follow the following steps:
1. Open MATLAB and change the working directory to the same folder as the opencsv 2.3.jar and installCSVReader.m
2. Run the install script by typing 'installCSVReader' in the MATLAB command window
Developers:
------------
If you would like to contribute to the development of this function, you can fork this project from my BitBucket repository: https://bitbucket.org/kkusano/csvreader
引用格式
Kristofer Kusano (2024). csvreader (https://www.mathworks.com/matlabcentral/fileexchange/43551-csvreader), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!