Matlab reads EXCEL intelligent algorithm data file

Matlab reads EXCEL intelligent algorithm data file

#前言
In the artificial intelligence control and performance forecasting project for a steel company, a large amount of data needs to be processed. I feel that this piece of code may be useful to everyone, so I posted it.
When using intelligent algorithms for classification or regression, it is necessary to first construct the input matrix and output matrix required by the algorithm model, or a data set. The data saved format is often EXCEL, CSV or TXT, which requires us to write code to read out the data.

Data association

Picture 1
Figure 1 Experimental resultsPicture 1: Experimental results

Picture 2 Influencing factorsPicture 2. Influencing factors

Matlab code implementation

[loadNumOut,loadTxtOut]=xlsread(‘strength20.xls’,‘Sheet1’,‘C2:H1987’);
[loadNumRela,loadTxtRela]=xlsread(‘relation2.xls’,‘20Cr’,‘A2:B780’);
[loadNumIn,loadTxtIn]=xlsread(‘composition.xls’,‘20Cr’,‘A2:X500’);

outputLine=[];
inputLine = [];
for h = 1:1:size(loadTxtOut)% cycle impact test record

       have=0;
       %haveout=0;
       midLineout=[];%中间存贮变量
       midLinein=[];%中间存贮变量
       for k = 1:1:size(loadTxtRela)
         if strcmp(loadTxtOut(h,1),loadTxtRela(k,1))               
        for j = 1:1:size(loadTxtIn)%循环成份           
            if strcmp(loadTxtIn(j,1),loadTxtRela(k,2))
              
                    have=1;
              
                  midLinein = [loadNumIn(j,:)];           
                  midLineout = [loadNumOut(h,:)];           
       
            end            
           end
         end
     end
      if have==1          
          outputLine=[outputLine;midLineout];          
          inputLine=[inputLine;midLinein];              
      end  
 end
  inputData2=inputLine;
  outputData2=outputLine; 
  
  minputData=[inputData1;inputData2];
  moutputData=[outputData1;outputData2];
  inputData=[minputData,moutputData(:,1)];
  outputData=moutputData(:,2:end);

save strengthdata20Cr inputData1 outputData1 inputData2 outputData2 inputData outputData

Continuation

This project is an artificial intelligence control and performance forecast for steel companies, which requires a large amount of data to be read out and processed. Reading is only the first step. If you are interested, you can contact me for other codes. Email: [email protected],.cn

Guess you like

Origin blog.csdn.net/lch737171__/article/details/109155283