datastore won't read variable names

조회 수: 13 (최근 30일)
Rachelie Leber
Rachelie Leber 2020년 9월 21일
편집: Rachelie Leber 2020년 9월 21일
Hi,
I'm trying to read data from a large csv file using matlab 2020a.
However, the variable names aren't read and I get 'Var_1', 'Var_2' etc. as the variable names.
How can I make it read the variable names?
Thanks
____
EDIT: The problem was the 'NumHeaderLines' property. It was automatically set to 1 when it should have been set to 0.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 9월 21일
Use PreserveVariableNames options
ds = datastore('filename', 'PreserveVariableNames', true)
  댓글 수: 3
Ameer Hamza
Ameer Hamza 2020년 9월 21일
Is there any error?
Rachelie Leber
Rachelie Leber 2020년 9월 21일
No, but the varible names are set to 'Var1', 'Var2' even though there are different headers in the csv file.

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

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by