フィルターのクリア

Read csv with quotes and numbers

6 ビュー (過去 30 日間)
AG15
AG15 2022 年 9 月 14 日
回答済み: Chunru 2022 年 9 月 14 日
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
What would you recommend? Thanks a lot!

採用された回答

Chunru
Chunru 2022 年 9 月 14 日
type data.txt
1,"10,10,A" 4,"10,14,A" 15,"10,11,B"
fid=fopen("data.txt", "r")
fid = 3
a=fscanf(fid, '%d,"%d,%d,%c"', [4 inf])'
a = 3×4
1 10 10 65 4 10 14 65 15 10 11 66
fclose(fid)
ans = 0

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by