FENGRUN

来源:互联网 发布:centos6.5 yum安装 编辑:程序博客网 时间:2024/06/09 14:09

% function []=StatementProcess(file_name)
clear
file_name='景富';
file_name01='丰润';

tic
%% Data import
%Pull
[DataRaw, TextRaw, Raw]=xlsread(file_name,'流水单');

[DataRaw01, TextRaw01, Raw01]=xlsread(file_name01,'流水单');

%Assign
Titles=TextRaw(1,:); %此处使用了旧日期,可以不用管

Captital_0=DataRaw(1,end); %这是哪个总值

Text=TextRaw(3:end,1:3);  %新数据要补齐时间
aa01 = Text(4,1);

Text01(:,1) =Raw01(3:end,1);
Text01(:,2) = TextRaw01(3:end,2);
Text01(:,3) = TextRaw01(3:end,3);
ab01 = Text01(4,1);

Data=DataRaw(2:end,1:2);
Data01=DataRaw01(2:end,4:5);


%Eliminate the unnecessary
DataT=num2cell(Data); %添加新列
DataT01 =num2cell(Data01);

DataAllR=[Text DataT];
DataAllR01=[Text01 DataT01];

LL0=length(DataAllR);

LL001=length(DataAllR01);

Manip={'证券买入' '证券卖出' '新股入帐' '红股入帐' '银行转取' '银行转存'};

DataAll=cell(size(DataAllR)); %只留下 '证券买入' '证券卖出'

DataAll01=DataAllR01;


step=0;
for ii=1:LL0    
    %ii=1;
    condition1=sum(strcmp(DataAllR{ii,2},Manip(5:end))); %> 0
    condition2=sum(strcmp(DataAllR{ii,2},Manip(1:4)));
    SecL=floor(str2double(cell2mat(DataAllR(ii,3)))/1000);
    criterion2=(SecL==0 || SecL==2 || SecL==300 || floor(SecL/10)==60)*condition2;
    if condition1 > 0 || criterion2 > 0
        DataAll(ii-step,:)=DataAllR(ii,:);
    else
        step=step+1;
    end
end


step01=0;
for ii=1:LL001  
    %ii=1;
    condition1=sum(strcmp(DataAllR01{ii,2},Manip(5:end))); %> 0
    condition2=sum(strcmp(DataAllR01{ii,2},Manip(1:4)));
    SecL=floor(str2double(cell2mat(DataAllR01(ii,3)))/1000);
    criterion2=(SecL==0 || SecL==2 || SecL==300 || floor(SecL/10)==60)*condition2;
    if condition1 > 0 || criterion2 > 0
        DataAll01(ii-step01,:)=DataAllR01(ii,:);
    else
        step01=step01+1;
    end
end


ValidL=sum(cell2mat(DataAll(:,end))~=0);%☆
DataAll=DataAll(1:ValidL,:);


ValidL01=sum(cell2mat(DataAll01(:,end))~=0);%☆
DataAll01=DataAll01(1:ValidL01,:);






%Formation 如下都要有
DateRe=str2num(cell2mat(DataAll(:,1)));

DateRe01=cell2mat(DataAll01(:,1));%更正


DateW=unique(DateRe);

DateW01=unique(DateRe01);

Datet=DateTransform(DateW);%Date in string 变成//

Datet01=DateTransform(DateW01);

Datet=tdays(Datet{1}, Datet{end});%Date in string


DateW=year(Datet)*10000+month(Datet)*100+day(Datet);

Daten=datenum(Datet);%Date in matlab number
TimeL=length(Datet);%☆

Maniplt=DataAll(:,2);

0 0
原创粉丝点击