gpt4 book ai didi

matlab - 将某些文本放入matlab中的向量中

转载 作者:太空宇宙 更新时间:2023-11-03 19:42:04 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
finding a specific data from a text file in matlab

我已经打开了名为“gos.txt”的文本文件使用以下代码:

s={}; 
fid = fopen('gos.txt');
tline = fgetl(fid);
while ischar(tline)
s=[s;tline];
tline = fgetl(fid);
end

我得到的结果如下: 小号 =

'[Term]'    
'id: GO:0008150'
'name: biological_process'
'namespace: biological_process'
'alt_id: GO:0000004'
'alt_id: GO:0007582'
[1x243 char]
[1x445 char]
'subset: goslim_aspergillus'
'subset: goslim_candida'
'subset: goslim_yeast'
'subset: gosubset_prok'
'synonym: "biological process" EXACT []'
'synonym: "biological process unknown" NARROW []'
'synonym: "physiological process" EXACT []'
'xref: Wikipedia:Biological_process'
'[Term]'
'id: GO:0016740'
'name: transferase activity'
'namespace: molecular_function'
[1x326 char]
'subset: goslim_aspergillus'
'subset: goslim_candida'
'subset: goslim_metagenomics'
'subset: goslim_pir'
'subset: goslim_plant'
'subset: gosubset_prok'
'xref: EC:2'
'xref: Reactome:REACT_25050 "Molybdenum ion transfer onto molybdopterin, Homo sapiens"'
'//is_a: GO:0003674 ! molecular_function'
'is_a: GO:0008150 ! molecular_function (added by Zaid, To be Removed Later)'
'//relationship: part_of GO:0008150 ! biological_process'
'[Term]'
'id: GO:0016787'
'name: hydrolase activity'
'namespace: molecular_function'
[1x186 char]
'subset: goslim_aspergillus'
'subset: goslim_candida'
'subset: goslim_metagenomics'
'subset: goslim_plant'
'subset: gosubset_prok'
'xref: EC:3'
'//is_a: GO:0003674 ! molecular_function'
'is_a: GO:0016740 ! molecular_function (added by Zaid, to be removed later)'
'relationship: part_of GO:0008150 ! biological_process'
'[Term]'
'id: GO:0006810'
'name: transport'
'namespace: biological_process'
'alt_id: GO:0015457'
'alt_id: GO:0015460'
[1x255 char]
'subset: goslim_aspergillus'
'subset: goslim_candida'
'synonym: "small molecule transport" NARROW []'
'synonym: "solute:solute exchange" NARROW []'
'synonym: "transport accessory protein activity" RELATED [GOC:mah]'
'is_a: GO:0016787 ! biological_process'
'relationship: part_of GO:0008150 ! biological_process'
.
.
.
.

之后的步骤是如何获取某个字符并将其放入向量中。例如:我想将所有包含“id: GO:*********”的行放入向量中,我也想得到 'is_a: GO:*********' 到一个向量,注意我不想在同一行后面的字符。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com