i hope someone can help me, how to achieve this. I have to files with list of data, i am trying to calculate possible permutations between the two lists and save them to a new file. i realized that my output file is very big ( more than 30 Gb ). i would like to know how to make permutation only between the data that meets specific criteria. F.eks if :
Data 1: VHxBxVVxPx255x98x
Data 2: VHxBxVVxPx255x98x
only permutate if char(6 and 7) from data1 = char(6 and 7) from data2.
my code so far :
fid = fopen( 'file1.txt' );
cac = textscan( fid, '%20s' );
fclose( fid );
num = cac{1};
fid = fopen( 'file2.txt' );
cac = textscan( fid, '%20s' );
fclose( fid );
str = cac{1};
fid = fopen( 'file3.txt', 'w' );
for ii = 1 : length( num )
for jj = 1 : length( str )
fprintf( fid, '%1s - %1s\n', num{ii}, str{jj} );
end
end
fclose( fid );
@ Kostya ... i could unfortunetly not get your code to work. but i managed to get it work changing my code as so :
fid = fopen( 'file1.txt' ); cac = textscan( fid, '%20s' ); num = cac{1}; fclose( fid );
fid = fopen( 'file2.txt' ); cac = textscan( fid, '%20s' ); str = cac{1}; fclose( fid );
fid = fopen( 'file3.txt', 'w' );
for i = 1 : length(num)
for j = 1 : length(str)
compare = strcmp(num{i}(1:2),str{j}(1:2));
if compare == 0
fprintf( fid, '%1s%1s\n', num{i}, str{j} );
end
end
end
fclose( fid );