代码之家  ›  专栏  ›  技术社区  ›  swapnil gandhi

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

  •  1
  • swapnil gandhi  · 技术社区  · 8 年前

    我正在阅读excel文件

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

    上述代码读取表D1中的数据。Excel工作表看起来很逼真 enter image description here

    诊断 列(最后一列)。

    如果用户需要带有术语“的诊断数据 PD ".

    请帮忙

    1 回复  |  直到 8 年前
        1
  •  0
  •   swapnil gandhi    8 年前

    我找到了解决方案

    代码如下:

    [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