Rename Excel column heading to MATLAB

11 ビュー (過去 30 日間)
Megan
Megan 2020 年 2 月 12 日
編集済み: Megan 2020 年 2 月 19 日
Hello everybody question is in the heading

採用された回答

Bhaskar R
Bhaskar R 2020 年 2 月 12 日
編集済み: Bhaskar R 2020 年 2 月 12 日
data = readtable('<your xlsx file name>'); % read your file as table
data.Properties.VariableNames = {'Var1', 'Var2', ..... so on as your data and required column names}
writetable(data, '<your xlsx file name>') % write back modified data to excel file
  3 件のコメント
Megan
Megan 2020 年 2 月 12 日
Is it possible do input a csv file? Because my xls deleted some of the columns.
I tried this:
data = readtable ("data.csv");
And I get this Error code:
Error using readtable (line 216)
Cannot interpret data in the file 'data.csv'. Found 2 variable names but 1
data columns. You may need to specify a different format, delimiter, or number
of header lines.
Note: readtable detected the following parameters:
'Delimiter', ',', 'HeaderLines', 22, 'ReadVariableNames', true, 'Format', '%q'
Error in analysis (line 3)
data = readtable ("data.csv");
Bhaskar R
Bhaskar R 2020 年 2 月 12 日
"What do I have to wirte instead of 'Var1'? The variable names of my Excel (KB61_10) or the renamed version (like_01)?" -Yes
"Is it possible do input a csv file?" -Yes
You got error because data in csv file is in not proper way, to avoid error/get data give appropriate inputs to the readtable
for more details

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by