How can one write out the set of possible values of a variable?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a table
Year
--
2020
2018
2017
2016
I want to write out all the values that the variable 'Year' takes. One way might be to use 'tabulate.' But is there simpler way?
0 件のコメント
回答 (1 件)
Prateek Rai
2020 年 6 月 18 日
編集済み: Prateek Rai
2020 年 6 月 18 日
As per my understanding, you are having a table from which you want to write out all the values that a variable takes.
You can do this by using dot notation in following way: “Table_name.Variable_name”
Here is a sample code :
t=table([2020;2018;2017;2016],'VariableNames',{'Year'}) % creating table
yr = t.Year % will output all the values of Year Variable
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!