Dowemo

In mathematical modeling, excel is often used to save data, and it's also necessary to import data into matlab.
1. Fi & t read excel tables; to use the xlsread function, the return value of xlsread has three forms.


 NUMERIC = xlsread(FILE);


 [NUMERIC,TXT]=xlsread(FILE);


 [NUMERIC,TXT,RAW]=xlsread(FILE);






Numeric is the returned data, and txt is the returned character, and raw is the entire table.
Where the input parameter is the following form, file is the file name, sheet is the name of the worksheet, and range is range.


[NUMERIC,TXT,RAW]=XLSREAD(FILE,SHEET,RANGE)






Specific examples are as follows


[n2,t2,r2]=xlsread('cumcm2010a-data1.xls','无变位出油','C2:D75')






Sometimes because the number is too large, matlab automatically converts to exponential display, which will lose progress, so you can use the following command to


format long g






In some cases, you need to write data to excel tables to use the xlswrite function, as follows


xlswrite(fn,S,'sheet3','A1');






Fn is the file name, and s is the data that's needed to save, and sheet3 is the name of the worksheet to save, and"a1"is the starting position.




Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs