function testClassificationPhysioMaxLengthNew4Function2QRSratioAlotAddn(strr)
load(strr);
% [newfeaturesTrain,newY_Train]=fixMajorMinorMultiClassRatio(featuresTrain,Y_Train,ratios)
% ('physio2017DataA1','ecgTrain','QRSTrain','AFEvTrain','RRTrain','thecasesTrain',
% 'ecgTest','QRSTest','AFEvTest','RRTest','thecasesTest');
noTrain=length(ecgTrain);
noTest=length(ecgTest);
minLengthEcg=1111111;
maxLengthEcg=0;
indexMin=0;indexMax=0;
for i=1:noTrain
    ll=length(ecgTrain{i});
    if ll<minLengthEcg
        minLengthEcg=ll;
        indexMin=i;
    end
    if ll>maxLengthEcg
        maxLengthEcg=ll;
        indexMax=i;
    end
end
for i=1:noTest
    ll=length(ecgTest{i});
    if ll<minLengthEcg
        minLengthEcg=ll;
    end
    if ll>maxLengthEcg
        maxLengthEcg=ll;
    end
end
ecgTrainVec=zeros(noTrain,maxLengthEcg);
ecgTestVec=zeros(noTest,maxLengthEcg);
featuresTrain=zeros(noTrain,9);
% featuresTest=zeros(noTest,475+19+78+6);
% featuresTrain=zeros(noTrain,41);
% featuresTest=zeros(noTest,41);
maxLengthEcg
for i=1:noTrain
    i
    lle=length(ecgTrain{i});
    %     nor=ceil(maxLengthEcg/lle);
    %     cecg = repmat(ecgTrain{i},[nor 1]);
    %     ecgTrainVec(i,:)=cecg(1:maxLengthEcg);
    YTrain(i)=thecasesTrain{i};
    %     cqrts=length(QRSTrain{i});
    %     ecgVectors={};
    %     zmax=1;
    %     for k=1:cqrts-1
    %         ecgVectors{k}=ecgTrain{i}(QRSTrain{i}(k):QRSTrain{i}(k+1));
    %         zmax=max(length(ecgVectors{k}),zmax);
    %     end
    %     zmax=max(zmax,100);
    %     ecgVV=zeros(cqrts-1,zmax);
    %     for k=1:cqrts-1
    %         ecgVV(k,1:length(ecgVectors{k}))=(ecgVectors{k});
    %     end
    %     [Zpca T U mu eigVecs] = myPCA(ecgVV,3);
    %     Zpca=Zpca(:,1:100);
    %     Zpca=Zpca(:)';
    %     %     Zpca=Zpca(
    %     N = length(ecgTrain{i});
    %
    %     xdft = fft(ecgTrain{i});
    %     xdft = xdft(1:N/2+1);
    %     psdx = (1/(2*pi*N)) * abs(xdft).^2;
    %     psdx(2:end-1) = 2*psdx(2:end-1);
    %     psdFeatures=[mean(psdx),min(psdx),max(psdx),std(psdx),moment(psdx,3)];
    %     averageDiff=200;
    %     if (cqrts)>2
    %         diff1=abs(diff(QRSTrain{i}));
    %         averageDiff=median(diff1);
    %     end
    %     if averageDiff>400
    %         averageDiff=200;
    %     end
    %     if isnan(averageDiff)
    %         averageDiff=200;
    %     end
    %     [ output_vector,totalOutput ] = SelectUpdatedNumberNoSegQRS( ecgTrain{i},10,QRSTrain{i} );
    % %         [peakLoc2, peakMag2] = peakfinder(ecgTrainVec(i,:));
    %     [peakMag1,peakLoc1] = findpeaks(abs(ecgTrain{i}),'MinPeakHeight',abs(mean(ecgTrain{i})),...
    %         'MinPeakDistance',averageDiff/3);
    %     peakMag1=ecgTrain{i}(peakLoc1);
    %     diffp=diff(peakLoc1);
    %     sortedPeaks=(peakMag1);
    %     p = polyfit(peakLoc1,sortedPeaks,5);
    % %     [sortedPeaks,si]=sort(peakMag1);
    % %     diffp=cumsum([1;diffp]);
    % %     p2 = polyfit(diffp,sortedPeaks,1);
    
    %     rr=3;
    % [Zpca T U mu eigVecs] = myPCA(v10_featuresu,rr);
    % output_vector=v10_featuresu;
    % totalOutput=[output_vector(:);Zpca(:)];
    %     size(totalOutput)
    [ln,lf]=dfa(ecgTrain{i});
    pp=polyfit(ln,lf,2);
    ffaa=[min(lf),max(lf),mean(lf),median(lf),std(lf),moment(lf,3),pp(1),pp(2),pp(3)];
    %     [yy,scale,info]=msentropy(ecgTrain{i});
    %     featuresTrain(i,:)=[ffaa,yy(:)'];
    featuresTrain(i,:)=[ffaa];
    %     size(Zpca)
    %     featuresTrain(i,:)=[psdFeatures,Zpca];
end
featuresTrain(isnan(featuresTrain)==1)=0;
YTrainA=YTrain;
featuresTrainA=featuresTrain;
ss=[strr,'CAdd'];
save(ss,'featuresTrainA','YTrainA')
