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!