matlab编程 文件的I/O

gmm1_list = fopen('gmm1_list.txt','rt');
gmm2_list = fopen('gmm2_list.txt','rt');

for n=1:1:1
ubm1 = fopen('ogg.mmf','rt');
ubm2 = fopen('wma.mmf','rt');

%-------------- fscanf(gmm1_list,'%s',1)不加参数1的话会把文本中所有内容提取出来------------------%
gmm1_path = fscanf(gmm1_list,'%s',1);
gmm2_path = fscanf(gmm2_list,'%s',1);
gmm1 = fopen(gmm1_path,'rt');
gmm2 = fopen(gmm2_path,'wt');
for m=1:1:11
    temp1 = fgets(gmm1);
    temp2 = fgets(ubm1);
    temp3 = fgets(ubm2);
    fprintf(gmm2,'%s',temp3);
end
for j=1:1:1
    temp1 = fgets(gmm1);
    temp2 = fgets(gmm1);
    temp3 = fgets(ubm1);
    temp4 = fgets(ubm1);
    temp1 = fgets(ubm2);
    fprintf(gmm2,'%s',temp1);
    temp2 = fgets(ubm2);
    fprintf(gmm2,'%s',temp2);
    %--------------------gmm1_mean-ubm1_mean---------------------------%

%------fscanf(gmm1,'%e/n',26);要添加/n,不加的话,下一步fgets不能提取下一行————%
    [gmm1_mean,count] = fscanf(gmm1,'%e/n',26);
    [ubm1_mean,count] = fscanf(ubm1,'%e/n',26);
    gmm1_ubm1_sub = gmm1_mean - ubm1_mean;
    [ubm2_mean,count] = fscanf(ubm2,'%e/n',26);
    temp1 = fgets(gmm1);
    temp2 = fgets(ubm1);
    temp3 = fgets(ubm2);

你可能感兴趣的:(matlab编程 文件的I/O)