Today, brother asked me to help write a simple text data extraction, simply wrote a MATLAB program, records for later use.
Data source: several. xls files
The contents of the file (extracted from the "first/two industry add value"):
The result is (equivalent to the collation of the data):
MATLAB program implementation (still need to improve):
[Num1,txt1,raw1]=xlsread ('name'); forkk=1:1:2[Num,txt,raw]=xlsread (Char(RAW1 (KK,1)) ; filename='Result.xls'; [I,j]=size (RAW); form=1:1: Iif(strcmp (RAW (M,1),'Indicators')) Result1= RAW (M,3: End); Endif(strcmp (RAW (M,1),'Primary Industry Add value')) Result2= RAW (M,3: End); Endif(strcmp (RAW (M,1),'second industry value added')) Result3= RAW (M,3: End); Endendresult= [RESULT1'result2'Result3'];[num, text, raw]=xlsread (filename); [Rown, ColumnN]=size (raw);if(rown==1) Xlsrange=['B', Num2str (rown)];xlsrange1=['A', Num2str (Rown)];ElseXlsrange=['B', Num2str (rown+1)]; XlsRange1=['A', Num2str (rown+1)]; End Xlswrite (Filename,result,1, Xlsrange); Xlswrite (Filename,raw (1,1),1, xlsRange1); end
Package download Instance + code:
..........................
Processing of text data