how to read complicated CSV files into matlab?
古いコメントを表示
My raw CSV file looks like the 1st pic. And I wants to use Matlab read it into the format as the 2rd pic. I have over 1000 the same kind of CSV files, it will be painful if I do it by copy/paste. How can I do this? Any examples? thanks.
I am a new user here, do not know how to post images, Please click the links to see. Thanks!
-------------------------------- raw data:
ID
Height
1 2 3
4 5 6
Weight
1 2 3
4 5 6
---------------------------
output data:
id height weight
1 1 1
1 2 2
1 3 3
...
採用された回答
その他の回答 (1 件)
Matt Kindig
2012 年 5 月 21 日
0 投票
Can you excerpt the actual text of your CSV file (not the file imported into Excel that you screenshot, but the actual original file with the commas shown and everything)? I ask because I don't think you'll be able to simply use csvread/dlmread, but will need to use a more sophisticated approach using something like fscanf or regexp. Please post an excerpt of your file.
Also, where does the ID come from? Are there other fields marked 'id' later in the file (such as A002)? Note that the raw/output data shown in your posting and in the screenshots is inconsistent--this makes it a bit confusing for me.
カテゴリ
ヘルプ センター および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!