How do I build a text file with readable variable names?

1 回表示 (過去 30 日間)
Milan Buncick
Milan Buncick 2019 年 11 月 15 日
コメント済み: Milan Buncick 2019 年 11 月 15 日
I'm trying to use datastore to open text files and then work with data from specific columns. The function does not recognize the variable names I've added to each column. How do I configure the text file so that datastore reads the variable names?

採用された回答

Philippe Lebel
Philippe Lebel 2019 年 11 月 15 日
I would try to set the 'PreserveVariableNames' flag to 'true' when uusing datastore.
something like:
datastore('very_file.csv','PreserveVariableNames',true)
  1 件のコメント
Milan Buncick
Milan Buncick 2019 年 11 月 15 日
Thanks. The text file had a separate tab at the end of each line which Matlab was interpreting as an addiitional column. Apparently Matlab was seeing 5 columns of data where there were only 4 variable labels and it was assigning default variable names to the 5 columns. When I remove the tabs at rhe end of each line the datstore function was able to read the variable names at the top of each column.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by