Suppose I have a table with row names but no variable names. I want to make the first row in my table (attached) to be recognized as the variables in my table and be able to have variables as my x axe in a plot when ploting the rows as a time series.

 採用された回答

Nagasai Bharat
Nagasai Bharat 2020 年 11 月 27 日

0 投票

Hi,
From my understanding you are trying make your first row as the variables of your table Tx. The following script would help you achieve it.
load Tx
VarNames = string(cell2mat(table2cell(Tx(1,:))));
Tx(1,:) = [];
Tx.Properties.VariableNames = VarNames;

1 件のコメント

Newbie
Newbie 2020 年 11 月 30 日
Hi Nagasai,
I ran the script and got the following message:
'300' is not a valid table variable name. See the documentation for isvarname or matlab.lang.makeValidName for more information.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

質問済み:

2020 年 11 月 23 日

コメント済み:

2020 年 11 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by