Renaming Variable Names in Table Matlab

1 回表示 (過去 30 日間)
Natalia Feced Garcia
Natalia Feced Garcia 2020 年 12 月 6 日
コメント済み: Star Strider 2020 年 12 月 6 日
Hi All,
I have been trying to rename the variable names to a table. I've been folowing the tutorials and indications given in the Mathworks website but I keep getting the following error message: Scalar structure required for this assignment.
I appreciate any kind of help you can give me.
My code is the following:
Compendium_2019 = table2struct(readtable("2019_Annual_Disability_Statistics_Compendium_ALL.csv", "PreserveVariableNames", true));
tot_population = Compendium_2019(2:54);
tot_population = rmfield(tot_population, {'Var6', 'Var7_1','Var8_1','Var9_1'});
% Things that I have tried and lead to the same error message:
tot_population.Properties.VariableNames{'Table 1.1 Resident Population - States: 2015 to 2018'} = {'State'};
tot_population.Properties.VariableNames([1:5]) = {'State','2015','2016','2017','2018'};
  3 件のコメント
Natalia Feced Garcia
Natalia Feced Garcia 2020 年 12 月 6 日
Oh that makes sense! Thank you for your help!
Star Strider
Star Strider 2020 年 12 月 6 日
My pleasure!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by