Read csv with quotes and numbers
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I have a csv file which contains the follwing format. Unfortunatelly it is not possible to remove the douuble quotes due to the method in which the data is generated. I am not able to parse out the data after the double quotes as the import data is treating it as a single field. Ideally I need to parse it as 1,10,10,A but it is not able to identify the delimiter in the double quotes.
data format:
1,"10,10,A"
4,"10,14,A"
15,"10,11,B"
Below is the readout when I try to import the data
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1124775/image.png)
What would you recommend? Thanks a lot!
댓글 수: 0
채택된 답변
Chunru
2022년 9월 14일
type data.txt
fid=fopen("data.txt", "r")
a=fscanf(fid, '%d,"%d,%d,%c"', [4 inf])'
fclose(fid)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!