0

I have a program based on some functionality and the results are displayed on 2 .csv files (file1 and file2) The files consist of same rows and columns, the columns are named as condition, supply1, supply2 I want to read both the files into the program, load them and then compare the contents of supply1, supply2, based on the condition and number. We have to compare the respective contents and display the difference of supply1 and suppy2 between those 2 files. Eg: condition ta and number 1 of the 4th row of file1 has to compare with condition ta and number 1 of the 1st row of file2 Please help me on this.

file 1 file 1 contents

file 2

  • What is your problem ? Where are you stuck ? Please post your code to show us what you've already done. – obchardon Jun 24 '20 at 13:16
  • file1 = fopen ( 'file1.csv' ); file2 = fopen ( 'file2.csv' ); data1 = textscan (file1, "%s,%f,%f,%d \n" , "HeaderLines" , 1, "Delimiter" , "," ) data2 = textscan (file2, "%s,%f,%f,%d \n" , "HeaderLines" , 1, "Delimiter" , "," ); fclose (file1); fclose (file2); I have extratced all the data but now I don't know how to compare since It has string values – Ganesh Kini Jun 24 '20 at 13:26
  • 1
    Please add updates and clarifications (**especially** code) to your question using [edit]. So your problem is comparing strings? How exactly do you want to compare them? For equality? Lexicographic ordering? Length? – beaker Jun 24 '20 at 15:51
  • add also example of data and of the expected comparison result – matzeri Jun 25 '20 at 12:50

0 Answers0