How can one write out the set of possible values of a variable?

조회 수: 3 (최근 30일)
alpedhuez
alpedhuez 2020년 6월 18일
편집: Prateek Rai 2020년 6월 18일
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?

답변 (1개)

Prateek Rai
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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by