Import data from CSV file by Import Tool or textscan

I can import data from csv file by Import Tool(out type:string), and the tool could creat a script(textscan in it) to instead Import Tool. But, when I use Import Tool or script to import csv file, it lost blank line which in csv file. How to solve it? Thanks.

댓글 수: 4

Why do you want a blank line in your matrix? You can't have that in a double matrix. You can't have one row be blank (all nulls). Explain why you think you need this.
kei hin
kei hin 2021년 11월 5일
편집: kei hin 2021년 11월 5일
I want to read the data to check it, lost blank line will give me a wrong position. csv file contains string and number just like a excel, but read it by string is fine, so please don't care the data type.
Read about readtable to load csv file.
kei hin
kei hin 2021년 11월 5일
편집: kei hin 2021년 11월 5일
readtable lost blank line too,and variable name in csv file will be changed. It is boring.

댓글을 달려면 로그인하십시오.

 채택된 답변

kei hin
kei hin 2021년 11월 5일
In the script which Import Tool created, change
delimiter = ',';
to
delimiter = {',','\r'};
It seems to have been solved.

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 11월 5일

0 개 추천

Use readmatrix() that would import all numerical data in a matrix form.

카테고리

제품

릴리스

R2017b

질문:

2021년 11월 5일

답변:

2021년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by