如何从 MATLAB 中的 table 列获取特定数据

How to get particular data from column of table in MATLAB

我有这种table。如下图所示。

Age    Height    Weight    Smoker    SelfAssessedHealthStatus
                ___    ______    ______    ______    ________________________

    Smith       38       71       176      true             Excellent        
    Johnson     43       69       163      false            Fair             
    Williams    38       64       131      false            Good             
    Jones       40       67       133      false            Fair             
    Brown       49       64       119      false            Good             
    Davis       46       68       142      false            Good             
    Miller      33       64       142      true             Good             
    Wilson      40       68       180      false            Good             
    Moore       28       68       183      false            Excellent        

现在我只需要“好”所在的行。这种类型的数据在最后一列中可用。 请帮忙。我是 MATLAB 的新手。

我准备了一个类似的 xlsx 文件,接下来用 readtable 函数读取它

T = readtable('test.xlsx','ReadVariableNames',false)

然后你可以创建逻辑数组来检测你需要的行:

idx = ismember(T.Var5,'LBNP:30')

接下来 select 这些行:

T(idx,:)