Info

This question is closed. Reopen it to edit or answer.

Finding the indices of the elements of one array in another one with multiple repating

2 views (last 30 days)
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

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!