C = cell(10000, 2);
for j = 1:numel(C)
C{j, 1} = sprintf('STRR %d', j);
C{j, 2} = sprintf('STRR %d', j-2);
end
tic
[Matched, Col1, Col2] = intersect(C(:, 1), C(:, 2));
toc
tic
Str = strrep(C, 'STRR ', '');
Num = cellfun(@(x) sscanf(x, '%f'), Str);
[Matched, Col1, Col2] = intersect(Num(:, 1), Num(:, 2));
toc
2 Comments
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/445145-comparing-common-strings-in-two-large-string-arrays-imported-from-excel-using-xlsread#comment_671680
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/445145-comparing-common-strings-in-two-large-string-arrays-imported-from-excel-using-xlsread#comment_671680
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/445145-comparing-common-strings-in-two-large-string-arrays-imported-from-excel-using-xlsread#comment_671683
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/445145-comparing-common-strings-in-two-large-string-arrays-imported-from-excel-using-xlsread#comment_671683
Sign in to comment.