如何提取行数据根据细胞包含特定单词的文本在Matlab

73(30天)
你好,
我很坚持一个问题,我想从大Excel文件中提取某些变量分类生物从多个年Excel在MATLAB所以我可以处理它。我想提取所有列从L和数据的行号我需要从657828:1048576。我试过过滤函数在excel中,但它不工作所以我在MATLAB。我多么想过滤器,它包括列j叫什么 object_annotation_hierachy 和精确的物种我想过滤掉以下:
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Calanidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Metridinidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Candaciidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Heterorhabdidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Euchaetidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Metridinidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Cyclopoida_Oithonidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Acartiidae
Arthropoda_Crustacea_Maxillopoda_Copepoda_Calanoida_Temoridae
所有其他物种的变化但我想包括所有数据与桡足类的标题中。
我想进一步提取到的第一列的名称,叫object_id (“cruise2012”) 2016。
到目前为止是这样的代码,但是它不工作:
C = csvread (“cruise_2004_2016_ZooScan_dataset.csv”);
% R657828, C1048576(就在第一行代码用来显示位置)
桡足类包含(C.object_id = = =“cruise2012”)& (C.object_annotation_hierachy“桡足类”);
C1 = C(桡足类:);
任何帮助将是感谢!
5个评论
索菲娅
索菲娅 2023年5月30日在25
我已经上传,将虚拟文字取代,它通常是一个更长时间。我也分裂和numerized表中的分类和代码中有一个更简单的方法去做。因为我有numerized第一和第十行我用这段代码,但似乎仍然不工作。
选择= detectImportOptions ( “Zoocam.xlsx” );
opts.VariableTypes (2) = { “双” };
opts.VariableTypes (19) = { “双” };
opts.VariableTypes (20) = { “双” };
C = readtable ( “Zoocam.xlsx” 、选择);
C.index = (C。对象= = 2017 & C.object_annotation_hierarchy < 18);
C_new = C (C.index = = 1, { “对象” , “object_lat” , “object_lon” , “object_annotation_hierarchy” , “object_area” });
writetable (C_new 2017 _data.csv );

登录置评。

接受的答案

马特·J
马特·J 2023年5月27日在十九31
编辑:马特·J 2023年5月30日11:16
桡足类=包含(C.object_id,“cruise2012”)&
包含(C.object_annotation_hierarchy“桡足类”);
14日的评论

登录置评。

更多的答案(0)

s manbetx 845


释放

R2022a

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!