datastore won't read variable names

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 日

0 投票

Use PreserveVariableNames options
ds = datastore('filename', 'PreserveVariableNames', true)

3 件のコメント

Rachelie Leber
Rachelie Leber 2020 年 9 月 21 日
Hi, Thanks for your response. Unfortunately, that doesn't seem to work...
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.

サインインしてコメントする。

カテゴリ

質問済み:

2020 年 9 月 21 日

編集済み:

2020 年 9 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by