Does one rename variable names after reading data?

1 回表示 (過去 30 日間)
alpedhuez
alpedhuez 2020 年 11 月 26 日
コメント済み: alpedhuez 2020 年 11 月 26 日
Suppose I do
T=readtable(test.xls)
It will create variables such as
T.variable1 T.variable2
It might be cumbersome to type
T.
all the time. Thus one thing one can think of is to set
variable1=T.variable1
Is this what is supposed to do?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 26 日
編集済み: Ameer Hamza 2020 年 11 月 26 日
Although possible, creating variable names like variable1, variable2, ... is not a good coding practice: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval. It might appear "cumbersome" to type "T." again and again, but in the long run, you will realize that this is much more flexible and efficient coding approach. Also, MATLAB supports several operations on tables which make thing easy. That will not be possible if you create separate variables.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by