Info
此问题已关闭。 请重新打开它进行编辑或回答。
Finding the indices of the elements of one array in another one with multiple repating
2 次查看(过去 30 天)
显示 更早的评论
i need to find contents of rxn in file1 and when the contents were the same, the contents of dor with the same indices with file1 would be copied to a new file, file1 and dor are two columns of an excel file, the problem is that some of arrays of rxn are repeated multiple times in file1 and for each of them there is a different contents in dor, i run the following function but it copies all of dor contents in one cell, for example 1.2.3.3 is a content of file1 and is repeated 4 times and there are 4 different contents in dor, for example:
asis
sudd
sjuh
kijh
i'm going to create a new file with this shape: 1.2.3.3 asis
1.2.3.3 sudd
1.2.3.3 sjuh
1.2.3.3 kijh
but here is what i gained: 1.2.3.3 asissuddsjuhkih what is the problem by my code? here is my code:
x={};
for i=1:numel(file1)
f=find(ismember(file1,rxn(i)));
z=dor(f);
z=z'
s=cell2mat(z);
x(i)={s};
end
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!