标签:处理 -- nbsp legend 美国 fir for over 数学
function [China_RR,USA_RR,Italy_RR,France_RR,Australia_RR,Korea_RR,India_RR ]= getdata(rawcsvdata,Flag) for i=1:length(rawcsvdata) % if strcmp(rawcsvdata{i,2},‘China‘)==1 %33+Taiwan % count_China=i; % count_China=count_China+1; if strcmp(rawcsvdata{i,2},‘China‘)==1 %33+Taiwan count_China_start=i-32; count_China_end=i; China_33=rawcsvdata(count_China_start:count_China_end,:); %提取出33个省的数据; elseif strcmp(rawcsvdata{i,2},‘Taiwan*‘)==1 %提取出台湾的数据 taiwan=rawcsvdata(i,:); % elseif strcmp(rawcsvdata{i,2},‘United States of America‘)==1 % %time_series_covid_19_confirmed.csv 文件中是 ‘United States of America‘ elseif strcmp(rawcsvdata{i,2},‘US‘)==1 %time_series_covid_19_confirmed.csv 文件中是‘US‘ USA_R=rawcsvdata(i,:); elseif strcmp(rawcsvdata{i,2},‘Italy‘)==1 Italy_R=rawcsvdata(i,:); % elseif strcmp(rawcsvdata{i,2},‘France‘)==1 % row 118 % France_R=rawcsvdata(i,:); elseif strcmp(rawcsvdata{i,2},‘Australia‘)==1 %澳洲=澳洲部分地区相加 count_Aus_start=i-7; count_Aus_end=i; Australia_8=rawcsvdata(count_Aus_start:count_Aus_end,:); %提取出8个省的数据; elseif strcmp(rawcsvdata{i,2},‘Korea, South‘)==1 %找不到韩国的 Korea_R=rawcsvdata(i,:); %% elseif strcmp(rawcsvdata{i,2},‘India‘)==1 India_R=rawcsvdata(i,:); % elseif (strcmp(rawcsvdata{i,2},‘China‘)==1)&&(strcmp(rawcsvdata{i,1},‘Deaths‘)==1) % China_Deaths=rawcsvdata(i,:); end if Flag==1 France_R=rawcsvdata(118,:); elseif Flag==2 France_R=rawcsvdata(110,:); end end China_34R=[China_33;taiwan]; China_34RR=cell2mat(China_34R(:,5:end)); China_RR=sum(China_34RR,1); %34个省求和(按列) USA_RR=cell2mat(USA_R(:,5:end)); Italy_RR=cell2mat(Italy_R(:,5: end)); France_RR=cell2mat(France_R(:,5:end)); Australia_8R=cell2mat(Australia_8(:,5:end)); Australia_RR=sum(Australia_8R,1); Korea_RR=cell2mat(Korea_R(:,5:end)); India_RR=cell2mat(India_R(:,5:end)); end
所需数据文件:https://files.cnblogs.com/files/feynmania/data.rar
数学建模省赛小结:数据预处理(按照关键字提取行/列并进行简单运算)
标签:处理 -- nbsp legend 美国 fir for over 数学
原文地址:https://www.cnblogs.com/feynmania/p/13354369.html