Column Headers from Imported Data

When importing Data from an ASCII file, it only saves one row of text for the column headers but I would like it to save two rows of text as column headers. Both are tab delimited. How do I import the file with two rows of Column Headers?

3 件のコメント

Bhaskar R
Bhaskar R 2019 年 11 月 6 日
No text file attatched.
Have you tried the MATLAB command ?
importdata
Jonathan Rua
Jonathan Rua 2019 年 11 月 6 日
Yes. That was the command I was using but the tab delimiter only works on the row above the data and not two rows above. I found that if I use the command:
readtable
then it will use the delimiter on that row but I have yet to see if it works for what I want.
Star Strider
Star Strider 2019 年 11 月 6 日
In readtable, under Text Files Only, see the 'HeaderLines' name-value pair. (Cannot link directly to it.)

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

回答 (1 件)

Subhadeep Koley
Subhadeep Koley 2019 年 11 月 8 日

0 投票

Hi, refer the example below.
filename = fullfile(matlabroot,'examples','matlab','myCsvTable.dat');
n = 2; % Number of rows to be skipped at the beginning
T = readtable(filename,'HeaderLines',n);
Hope this helps!

カテゴリ

ヘルプ センター および File ExchangeLarge Files and Big Data についてさらに検索

タグ

質問済み:

2019 年 11 月 6 日

回答済み:

2019 年 11 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by