How to import data from a csv that contains strings numbers and blank cells
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a csv that contains a single column with a lot of data in it. The data is a variety of strings, numbers and blanks, where I want to keep it in the exact order including all of the blank cells. So an example of the data would be:
A
05
G
12
I have tried to use importdata and this works perfectly, the problem is my csv has over 1 million rows and for some reason using importdata only imports to just over the first 100k rows.
Any help would be appreciated!
댓글 수: 5
Philip Caplan
2015년 4월 15일
Have you tried using "csvread" to import the entire column? For some examples, please see:
채택된 답변
Star Strider
2015년 4월 16일
I would experiment with textscan.
Example:
fidi = fopen('filename.csv');
D = textscan(fidi, '%s', 'Delimiter',',');
fclose(fidi);
This should read everything in as a cell array of strings. (I don’t have your file, so this is just a guess on my part. I will leave it to you to experiment.) You may need other arguments in the textscan call (such as 'EndOfLine'), but it may work as described here without any changes.
추가 답변 (1개)
Roberto Herrera-Lara
2015년 4월 14일
100k rows, and if you do the same process several times(10 times) and then you concatenate the matrixs, i dont know, perhaps works!! =) Divide and conquer algorithm
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!