Compare files with MATLAB

后端 未结 5 1433
时光取名叫无心
时光取名叫无心 2021-01-22 06:36

I would like to know how could I compare two files (line by line) (*.xml, .m,.txt,...etc) using MATLAB.

file1 = \'toto.xml\';
file2 = \'titi.xml\';
         


        
5条回答
  •  终归单人心
    2021-01-22 07:18

    In case that you have a file (or a path) with spaces (like c:\my folder\myfile.m), wrap the file name with quotation mark (") in the DOS command. Note that the apostrophe is still needed:

    file_name_1 = 'file 1.txt';
    file_name_2 = 'file 2.txt';
    
    [status,result] = system(['fc ', '"', file_name_1, '" "', file_name_2, '"']);
    

    Alternatively, you can put the quotation mark as soon as you define the variable of the file name:

    file_name_1 = '"file 1.txt"';
    file_name_2 = '"file 2.txt"';
    
    [status,result] = system(['fc ' file_name_1 ' ' file_name_2]);
    

提交回复
热议问题