matlab 读取 excel 并获取包含搜索词的行

matlab read excel and fetch rows containing search term

我正在阅读 excel 文件

[num, txt, raw] =  xlsread('D://qq.xls','D1');

以上代码读取sheet D1中的数据。 Excelsheet这样的生活

我只想获取并显示那些包含用户提供的搜索词的行。搜索词将来自 diagnosis 列(最后一列)。

例如。 如果用户想要带有术语“PD”的诊断数据。

我们怎样才能得到它?

请帮忙

我找到了解决方案

代码如下:

[num, txt, raw] =  xlsread('D://qq.xls','D1','B2:HH24');// read excel file
B = raw.'; // transpose it
qq=B(1:end, 23);//get diagnosis column
x = strmatch('NODB', qq);//find match for cell array it returns row index
qq=B(x, :); //fetch data from row index

谢谢:)