Saving cell arrays as table in matlab
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've 3 excel files in a folder and each excel file has 5 columns, I'm trying to fill gaps in dataset by using 9 interpolation techniques. There are 3 performance indicators for these interpolations. I'm trying very basic knowledge of matlab programming. At the end I'm trying to save result of performance indicator of each interpolation with the same file name on which this process runed. I'm getting same data for 3 files in output but all dataset is same e.g., excel sheet 1 of all files contain same result. Please guide me where is the mistake or if someone correct it I'll be very thankful for this fevor?. My code is given below:
clear;
files=dir('*.xlsx');
%saving files for interpolations
Ecp = cell(length(files),4);
Ecn = cell(length(files),4);
Ecnn = cell(length(files),4);
Ecl = cell(length(files),4);
Ecs = cell(length(files),4);
Ecpp = cell(length(files),4);
Ecm = cell(length(files),4);
Ecy = cell(length(files),4);
Ecmm = cell(length(files),4);
%after meeting optimizations
ECP = cell(length(files),4);
ECN = cell(length(files),4);
ECNN = cell(length(files),4);
ECL = cell(length(files),4);
ECS = cell(length(files),4);
ECPP = cell(length(files),4);
ECM = cell(length(files),4);
ECY = cell(length(files),4);
ECMM = cell(length(files),4);
nanidd = cell(length(files),4,1000); % declar before using please
% krcp=zeros(1000,1);
myarcp1=[];
mybrcp1 =[];
mycrcp1 =[];
myarcp2=[];
mybrcp2 =[];
mycrcp2 =[];
myarcp3=[];
mybrcp3 =[];
mycrcp3 =[];
myarcp4=[];
mybrcp4 =[];
mycrcp4 =[];
%
myaecn1=[];
mybecn1=[];
mycecn1=[];
myaecn2=[];
mybecn2=[];
mycecn2=[];
myaecn3=[];
mybecn3=[];
mycecn3=[];
myaecn4=[];
mybecn4=[];
mycecn4=[];
%
myaecnn1=[];
mybecnn1=[];
mycecnn1=[];
myaecnn2=[];
mybecnn2=[];
mycecnn2=[];
myaecnn3=[];
mybecnn3=[];
mycecnn3=[];
myaecnn4=[];
mybecnn4=[];
mycecnn4=[];
%%%
myaecl1=[];
mybecl1=[];
mycecl1=[];
myaecl2=[];
mybecl2=[];
mycecl2=[];
myaecl3=[];
mybecl3=[];
mycecl3=[];
myaecl4=[];
mybecl4=[];
mycecl4=[];
%%%%
myaecs1=[];
mybecs1=[];
mycecs1 =[];
myaecs2=[];
mybecs2=[];
mycecs2 =[];
myaecs3=[];
mybecs3=[];
mycecs3 =[];
myaecs4=[];
mybecs4=[];
mycecs4=[];
%%%
myaecpp1=[];
mybecpp1 =[];
mycecpp1=[];
myaecpp2=[];
mybecpp2 =[];
mycecpp2=[];
myaecpp3=[];
mybecpp3 =[];
mycecpp3=[];
myaecpp4=[];
mybecpp4=[];
mycecpp4=[];
%
myaecm1=[];
mybecm1=[];
mycecm1=[];
myaecm2=[];
mybecm2=[];
mycecm2=[];
myaecm3=[];
mybecm3=[];
mycecm3=[];
myaecm4=[];
mybecm4=[];
mycecm4=[];
%
myaecy1=[];
mybecy1=[];
mycecy1=[];
myaecy2=[];
mybecy2=[];
mycecy2=[];
myaecy3=[];
mybecy3=[];
mycecy3=[];
myaecy4=[];
mybecy4=[];
mycecy4=[];
%
myaecmm1=[];
mybecmm1=[];
mycecmm1=[];
myaecmm2=[];
mybecmm2=[];
mycecmm2=[];
myaecmm3=[];
mybecmm3=[];
mycecmm3=[];
myaecmm4=[];
mybecmm4=[];
mycecmm4=[];
for i=1:length(files)
data = xlsread(files(i).name);
Ec=data(:,2);
Sar=data(:,3);
Esc=data(:,4);
Wl=data(:,5);
Vx=(1:1:20).';
t=data(:,1);
myvect ={Ec,Sar,Esc,Wl}; % vector has been declared here
%
myfile=files(i).name; % saving name of file
%% Training and Testing data
for m=1:4 % coressponding to variables
for k=1:1000 % optimization
numChannels = size(myvect{m},1);
var=myvect{m};
nanid=isnan(var); % finding id of nan
nanidx=find(nanid==1); % getting their positions in vector
nanidd{i,m,k}=nanidx;% Weights to interpolation please keep note them
%% acceptance & rejection random number
idx = randperm(numChannels);
rej=ismember (idx,nanidx); % finding the index of random number in nandix
idxxx{i,m,k}=idx(rej<1); % saving the ids of random numbers
idxx=idxxx{i,m,k};
%% training & testing
numidxx= length(idxx);
N = 0.80 ; % percentage 80%
dataTrain = var(idxx(1:round(numidxx*N)),:); %%%%%% number 1
dataValidation{i,m,k} = var(idxx(round(numidxx*N)+1:end),:); % selecting validating numbers
var(idxx(round(numidxx*N)+1:end),:)=nan; % making nan to validating dataset
%% Filling Ec
%
Ecp{i,m,k} = round(fillmissing(var,'previous'),2); % no optimization
% pause(2)
Ecn{i,m,k} = round(fillmissing(var,'next'),2); % no optimization
% pause(2)
Ecnn{i,m,k} =round( fillmissing(var,'nearest'),2); % no optimization
% pause(2)
Ecl{i,m,k} =round( fillmissing(var,'linear'),2); % yes
% pause(2)
Ecs{i,m,k} =round( fillmissing(var,'spline'),2);
% pause(2)
Ecpp{i,m,k} =round( fillmissing(var,'pchip'),2);
% pause(2)
Ecm{i,m,k} =round( fillmissing(var,'makima'),2);
% pause(2)
Ecy{i,m,k} =round( fillgaps(var),2); %autoregression
% pause(2)
Ecmm{i,m,k} =round( fillmissing(var,'movmean',5),2);
% pause(2)
%% Cross validation
rcp(i,m,k) = sqrt (mean ((Ecp{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2)); %(mean ((Ecp(idxx(round(numChannels*N)+1:end),:) - dataValidation).^2))
recp(i,m,k) = sqrt (mean ((Ecn{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recnn(i,m,k) = sqrt (mean ((Ecnn{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recl(i,m,k) = sqrt (mean ((Ecl{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));%%%%%
recs(i,m,k) = sqrt (mean ((Ecs{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recpp(i,m,k) = sqrt (mean ((Ecpp{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recm(i,m,k) = sqrt (mean ((Ecm{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recy(i,m,k) = sqrt (mean ((Ecy{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
recmm(i,m,k) = sqrt (mean ((Ecmm{i,m,k}(idxx(round(numidxx*N)+1:end),:) - dataValidation{i,m,k}).^2));
%
trcp(i,m,k) = calculateR2(dataValidation{i,m,k},Ecp{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecp(i,m,k) = calculateR2(dataValidation{i,m,k},Ecn{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecnn(i,m,k) = calculateR2(dataValidation{i,m,k},Ecnn{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecl(i,m,k) = calculateR2(dataValidation{i,m,k},Ecl{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecs(i,m,k) = calculateR2(dataValidation{i,m,k},Ecs{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(1)
trecpp(i,m,k) = calculateR2(dataValidation{i,m,k},Ecpp{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecm(i,m,k) = calculateR2(dataValidation{i,m,k},Ecm{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(0.01)
trecy(i,m,k) = calculateR2(dataValidation{i,m,k},Ecy{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
trecmm(i,m,k) = calculateR2(dataValidation{i,m,k},Ecmm{i,m,k}(idxx(round(numidxx*N)+1:end),:));
%
% pause(2)
mrcp(i,m,k) = calMAE(dataValidation{i,m,k},Ecp{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecp(i,m,k) = calMAE(dataValidation{i,m,k},Ecn{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecnn(i,m,k) = calMAE(dataValidation{i,m,k},Ecnn{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecl(i,m,k) = calMAE(dataValidation{i,m,k},Ecl{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(0.01)
mrecs(i,m,k) = calMAE(dataValidation{i,m,k},Ecs{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecpp(i,m,k) = calMAE(dataValidation{i,m,k},Ecpp{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecm(i,m,k) = calMAE(dataValidation{i,m,k},Ecm{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(0.01)
mrecy(i,m,k) =calMAE(dataValidation{i,m,k},Ecy{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
mrecmm(i,m,k) = calMAE(dataValidation{i,m,k},Ecmm{i,m,k}(idxx(round(numidxx*N)+1:end),:));
% pause(2)
%
if rcp(i,m,k)<0.1 && trcp(i,m,k) > 0.8; % use double when comparing one value
ECP{i,m,k}=Ecp{i,m,k};
arcp{i,m,k}=rcp(i,m,k);
brcp{i,m,k}=trcp(i,m,k);
crcp{i,m,k}= mrcp(i,m,k);
if i==1 % first file
myECP1(k,m)= ECP(i,m,k);
myarcp1(k,m)=arcp{i,m,k};
mybrcp1(k,m)=brcp{i,m,k};
mycrcp1(k,m)=crcp{i,m,k};
%
ECPId1 = ~cellfun('isempty', myECP1); % evaluating empty rows
myECP1(find(sum(ECPId1,2)==0),:)=[];
%
ECP1=myECP1(:,m);
ECPIID= ~cellfun('isempty', ECP1);
ECP1(find(sum(ECPIID,2)==0),:)=[];
for w=1:size(ECP1,1)
IECP1 (:,w)= ECP1{w,1};
end
elseif i==2
myECP2(k,m)= ECP(i,m,k);
myarcp2(k,m)=arcp{i,m,k};
mybrcp2(k,m)=brcp{i,m,k};
mycrcp2(k,m)=crcp{i,m,k};
ECPId2 = ~cellfun('isempty', myECP2);
myECP2(find(sum(ECPId2,2)==0),:)=[];
%
ECP2=myECP2(:,m);
ECP2ID= ~cellfun('isempty', ECP2);
ECP2(find(sum(ECP2ID,2)==0),:)=[];
for w=1:size(ECP2,1)
IECP2 (:,w)= ECP2{w,1};
end
elseif i==3;
myECP3(k,m)= ECP(i,m,k);
myarcp3(k,m)=arcp{i,m,k};
mybrcp3(k,m)=brcp{i,m,k};
mycrcp3(k,m)=crcp{i,m,k};
ECPId3 = ~cellfun('isempty', myECP3);
myECP3(find(sum(ECPId3,2)==0),:)=[];
%
ECP3=myECP3(:,m);
ECP3ID= ~cellfun('isempty', ECP3);
ECP3(find(sum(ECP3ID,2)==0),:)=[];
for w=1:size(ECP3,1)
IECP3 (:,w)= ECP3{w,1};
end
else%if i==4;
myECP4(k,m)= ECP(i,m,k);
myarcp4(k,m)=arcp{i,m,k};
mybrcp4(k,m)=brcp{i,m,k};
mycrcp4(k,m)=crcp{i,m,k};
ECPId4 = ~cellfun('isempty', myECP4);
myECP4(find(sum(ECPId4,2)==0),:)=[];
%
ECP4=myECP4(:,m);
ECP4ID= ~cellfun('isempty', ECP4);
ECP4(find(sum(ECP4ID,2)==0),:)=[];
for w=1:size(ECP4,1)
IECP4 (:,w)= ECP4{w,1};
end
end
elseif recp(i,m,k)<0.1 && trecp(i,m,k) > 0.8; % second interpolation
% krecp(k)=k;
ECN{i,m,k}= Ecn{i,m,k};
aecn {i,m,k}= recp(i,m,k);
becn {i,m,k}= trecp(i,m,k);
cecn {i,m,k} = mrecp(i,m,k);
if i==1 % first file
myECN1(k,m)= ECN(i,m,k);
myaecn1(k,m)=aecn{i,m,k};
mybecn1(k,m)=becn{i,m,k};
mycecn1(k,m)=cecn{i,m,k};
ECNId1 = ~cellfun('isempty', myECN1);
myECN1(find(sum(ECNId1,2)==0),:)=[];
%
ECN1=myECN1(:,m);
ECN1ID= ~cellfun('isempty', ECN1);
ECN1(find(sum(ECN1ID,2)==0),:)=[];
for w=1:size(ECN1,1)
IECN1 (:,w)= ECN1{w,1};
end
elseif i==2
myECN2(k,m)= ECN(i,m,k);
myaecn2(k,m)=aecn{i,m,k};
mybecn2(k,m)=becn{i,m,k};
mycecn2(k,m)=cecn{i,m,k};
ECNId2 = ~cellfun('isempty', myECN2);
myECN2(find(sum(ECNId2,2)==0),:)=[];
%
ECN2=myECN2(:,m);
ECN2ID= ~cellfun('isempty', ECN2);
ECN2(find(sum(ECN2ID,2)==0),:)=[];
for w=1:size(ECN2,1)
IECN2 (:,w)= ECN2{w,1};
end
elseif i==3;
myECN3(k,m)= ECN(i,m,k);
myaecn3(k,m)=aecn{i,m,k};
mybecn3(k,m)=becn{i,m,k};
mycecn3(k,m)=cecn{i,m,k};
ECNId3 = ~cellfun('isempty', myECN3);
myECN3(find(sum(ECNId3,2)==0),:)=[];
%
ECN3=myECN3(:,m);
ECN3ID= ~cellfun('isempty', ECN3);
ECN3(find(sum(ECN3ID,2)==0),:)=[];
for w=1:size(ECN3,1)
IECN3 (:,w)= ECN3{w,1};
end
else%if i==4;
myECN4(k,m)= ECN(i,m,k);
myaecn4(k,m)=aecn{i,m,k};
mybecn4(k,m)=becn{i,m,k};
mycecn4(k,m)=cecn{i,m,k};
ECNId4 = ~cellfun('isempty', myECN4);
myECN4(find(sum(ECNId4,2)==0),:)=[];
%
ECN4=myECN4(:,m);
ECN4ID= ~cellfun('isempty', ECN4);
ECN4(find(sum(ECN4ID,2)==0),:)=[];
for w=1:size(ECN4,1)
IECN4 (:,w)= ECN4{w,1};
end
end
elseif recnn(i,m,k)<0.1 && trecnn(i,m,k) > 0.8;
ECNN{i,m,k}= Ecnn{i,m,k};
aecnn {i,m,k}= recnn(i,m,k);
becnn {i,m,k}= trecnn(i,m,k);
cecnn {i,m,k} = mrecnn(i,m,k);
if i==1 % first file
myECNN1(k,m)= ECNN(i,m,k);
myaecnn1(k,m)=aecnn{i,m,k};
mybecnn1(k,m)=becnn{i,m,k};
mycecnn1(k,m)=cecnn{i,m,k};
ECNNId1 = ~cellfun('isempty', myECNN1);
myECNN1(find(sum(ECNNId1,2)==0),:)=[];
%
ECNN1=myECNN1(:,m);
ECNN1ID= ~cellfun('isempty', ECNN1);
ECNN1(find(sum(ECNN1ID,2)==0),:)=[];
for w=1:size(ECNN1,1)
IECNN1 (:,w)= ECNN1{w,1};
end
elseif i==2;
myECNN2(k,m)= ECNN(i,m,k);
myaecnn2(k,m)=aecnn{i,m,k};
mybecnn2(k,m)=becnn{i,m,k};
mycecnn2(k,m)=cecnn{i,m,k};
ECNNId2 = ~cellfun('isempty', myECNN2);
myECNN2(find(sum(ECNNId2,2)==0),:)=[];
%
ECNN2=myECNN2(:,m);
ECNN2ID= ~cellfun('isempty', ECNN2);
ECNN2(find(sum(ECNN2ID,2)==0),:)=[];
for w=1:size(ECNN2,1)
IECNN2 (:,w)= ECNN2{w,1};
end
elseif i==3;
myECNN3(k,m)= ECNN(i,m,k);
myaecnn3(k,m)=aecnn{i,m,k};
mybecnn3(k,m)=becnn{i,m,k};
mycecnn3(k,m)=cecnn{i,m,k};
ECNNId3 = ~cellfun('isempty', myECNN3);
myECNN3(find(sum(ECNNId3,2)==0),:)=[];
%
ECNN3=myECNN3(:,m);
ECNN3ID= ~cellfun('isempty', ECNN3);
ECNN3(find(sum(ECNN3ID,2)==0),:)=[];
for w=1:size(ECNN3,1)
IECNN3(:,w)= ECNN3{w,1};
end
else
myECNN4(k,m)= ECNN(i,m,k);
myaecnn4(k,m)=aecnn{i,m,k};
mybecnn4(k,m)=becnn{i,m,k};
mycecnn4(k,m)=cecnn{i,m,k};
ECNNId4 = ~cellfun('isempty', myECNN4);
myECNN4(find(sum(ECNNId4,2)==0),:)=[];
%
ECNN4=myECNN4(:,m);
ECNN4ID= ~cellfun('isempty', ECNN4);
ECNN4(find(sum(ECNN4ID,2)==0),:)=[];
for w=1:size(ECNN4,1)
IECNN4(:,w)= ECNN4{w,1};
end
end
elseif recl(i,m,k)<0.1 && trecl(i,m,k) > 0.8;
% krecl(k)=k;
ECL{i,m,k}= Ecl{i,m,k};
aecl {i,m,k} = recl(i,m,k);
becl {i,m,k} = trecl(i,m,k);
cecl {i,m,k} = mrecl(i,m,k);
if i==1 % first file
myECL1(k,m)= ECL(i,m,k);
myaecl1(k,m)=aecl{i,m,k};
mybecl1(k,m)=becl{i,m,k};
mycecl1(k,m)=cecl{i,m,k};
ECLId1 = ~cellfun('isempty', myECL1);
myECL1(find(sum(ECLId1,2)==0),:)=[];
%
ECL1=myECL1(:,m);
ECL1ID= ~cellfun('isempty', ECL1);
ECL1(find(sum(ECL1ID,2)==0),:)=[];
for w=1:size(ECL1,1)
IECL1 (:,w)= ECL1{w,1};
end
elseif i==2;
myECL2(k,m)= ECL(i,m,k);
myaecl2(k,m)=aecl{i,m,k};
mybecl2(k,m)=becl{i,m,k};
mycecl2(k,m)=cecl{i,m,k};
ECLId2 = ~cellfun('isempty', myECL2);
myECL2(find(sum(ECLId2,2)==0),:)=[];
%
ECL2=myECL2(:,m);
ECL2ID= ~cellfun('isempty', ECL2);
ECL2(find(sum(ECL2ID,2)==0),:)=[];
for w=1:size(ECL2,1)
IECL2 (:,w)= ECL2{w,1};
end
elseif i==3;
myECL3(k,m)= ECL(i,m,k);
myaecl3(k,m)=aecl{i,m,k};
mybecl3(k,m)=becl{i,m,k};
mycecl3(k,m)=cecl{i,m,k};
ECLId3 = ~cellfun('isempty', myECL3);
myECL3(find(sum(ECLId3,2)==0),:)=[];
%
ECL3=myECL3(:,m);
ECL3ID= ~cellfun('isempty', ECL3);
ECL3(find(sum(ECL3ID,2)==0),:)=[];
for w=1:size(ECL3,1)
IECL3 (:,w)= ECL3{w,1};
end
else%if i==4;
myECL4(k,m)= ECL(i,m,k);
myaecl4(k,m)=aecl{i,m,k};
mybecl4(k,m)=becl{i,m,k};
mycecl4(k,m)=cecl{i,m,k};
ECLId4 = ~cellfun('isempty', myECL4);
myECL4(find(sum(ECLId4,2)==0),:)=[];
%
ECL4=myECL4(:,m);
ECL2ID= ~cellfun('isempty', ECL2);
ECL2(find(sum(ECL2ID,2)==0),:)=[];
for w=1:size(ECL2,1)
IECL2 (:,w)= ECL2{w,1};
end
end
elseif recs(i,m,k)<0.1 && trecs(i,m,k) > 0.8;
% krecs(k) =k;
ECS{i,m,k}= Ecs{i,m,k};
aecs {i,m,k} = recs(i,m,k);
becs {i,m,k} = trecs(i,m,k);
cecs{i,m,k} = mrecs(i,m,k);
if i==1
myECS1(k,m)= ECS(i,m,k);
myaecs1(k,m)=aecs{i,m,k};
mybecs1(k,m)=becs{i,m,k};
mycecs1(k,m)=cecs{i,m,k};
ECSId1 = ~cellfun('isempty', myECS1);
myECS1(find(sum(ECSId1,2)==0),:)=[];
%
ECS1=myECS1(:,m);
ECS1ID= ~cellfun('isempty', ECS1);
ECS1(find(sum(ECS1ID,2)==0),:)=[];
for w=1:size(ECS1,1)
IECS1 (:,w)= ECS1{w,1};
end
elseif i==2;
myECS2(k,m)= ECS(i,m,k);
myaecs2(k,m)=aecs{i,m,k};
mybecs2(k,m)=becs{i,m,k};
mycecs2(k,m)=cecs{i,m,k};
ECSId2 = ~cellfun('isempty', myECS2);
myECS2(find(sum(ECSId2,2)==0),:)=[];
%
ECS2=myECS2(:,m);
ECS2ID= ~cellfun('isempty', ECS2);
ECS2(find(sum(ECS2ID,2)==0),:)=[];
for w=1:size(ECS2,1)
IECS2 (:,w)= ECS2{w,1};
end
elseif i==3;
myECS3(k,m)= ECS(i,m,k);
myaecs3(k,m)=aecs{i,m,k};
mybecs3(k,m)=becs{i,m,k};
mycecs3(k,m)=cecs{i,m,k};
ECSId3 = ~cellfun('isempty', myECS3); % searching Empty
myECS3(find(sum(ECSId3,2)==0),:)=[]; % Elme
%
ECS3=myECS3(:,m);
ECS3ID= ~cellfun('isempty', ECS3);
ECS3(find(sum(ECS3ID,2)==0),:)=[];
for w=1:size(ECS3,1)
IECS3 (:,w)= ECS3{w,1};
end
else%if i==4;
myECS4(k,m)= ECS(i,m,k);
myaecs4(k,m)=aecs{i,m,k};
mybecs4(k,m)=becs{i,m,k};
mycecs4(k,m)=cecs{i,m,k};
ECSId4 = ~cellfun('isempty', myECS4);
myECS4(find(sum(ECSId4,2)==0),:)=[];
%
ECS4=myECS4(:,m);
ECS4ID= ~cellfun('isempty', ECS4);
ECS4(find(sum(ECS4ID,2)==0),:)=[];
for w=1:size(ECS4,1)
IECS4 (:,w)= ECS4{w,1};
end
end
elseif recpp(i,m,k)<0.1 && trecpp(i,m,k) > 0.8;
% krecpp(k)=k;
ECPP{i,m,k}= Ecpp{i,m,k};
aecpp{i,m,k} = recpp(i,m,k);
becpp{i,m,k} = trecpp(i,m,k);
cecpp{i,m,k} = mrecpp(i,m,k);
if i==1;
myECPP1(k,m)= ECPP(i,m,k);
myaecpp1(k,m)=aecpp{i,m,k};
mybecpp1(k,m)=becpp{i,m,k};
mycecpp1(k,m)=cecpp{i,m,k};
ECPPId1 = ~cellfun('isempty', myECPP1);
myECPP1(find(sum(ECPPId1,2)==0),:)=[];
%
ECPP1=myECPP1(:,m);
ECPP1ID= ~cellfun('isempty', ECPP1);
ECPP1(find(sum(ECPP1ID,2)==0),:)=[];
for w=1:size(ECPP1,1)
IECPP1 (:,w)= ECPP1{w,1};
end
elseif i==2;
myECPP2(k,m)= ECPP(i,m,k);
myaecpp2(k,m)=aecpp{i,m,k};
mybecpp2(k,m)=becpp{i,m,k};
mycecpp2(k,m)=cecpp{i,m,k};
ECPPId2 = ~cellfun('isempty', myECPP2);
myECPP2(find(sum(ECPPId2,2)==0),:)=[];
%
ECPP2=myECPP2(:,m);
ECPP2ID= ~cellfun('isempty', ECPP2);
ECPP2(find(sum(ECPP2ID,2)==0),:)=[];
for w=1:size(ECPP2,1)
IECPP2 (:,w)= ECPP2{w,1};
end
elseif i==3;
myECPP3(k,m)= ECPP(i,m,k);
myaecpp3(k,m)=aecpp{i,m,k};
mybecpp3(k,m)=becpp{i,m,k};
mycecpp3(k,m)=cecpp{i,m,k};
ECPPId3 = ~cellfun('isempty', myECPP3);
myECPP3(find(sum(ECPPId3,2)==0),:)=[];
%
ECPP3=myECPP3(:,m);
ECPP3ID= ~cellfun('isempty', ECPP3);
ECPP3(find(sum(ECPP3ID,2)==0),:)=[];
for w=1:size(ECPP3,1)
IECPP3(:,w)= ECPP3{w,1};
end
else%if i==4;
myECPP4(k,m)= ECPP(i,m,k);
myaecpp4(k,m)=aecpp{i,m,k};
mybecpp4(k,m)=becpp{i,m,k};
mycecpp4(k,m)=cecpp{i,m,k};
ECPPId4 = ~cellfun('isempty', myECPP4);
myECPP4(find(sum(ECPPId4,2)==0),:)=[];
%
ECPP4=myECPP4(:,m);
ECPP4ID= ~cellfun('isempty', ECPP4);
ECPP4(find(sum(ECPP4ID,2)==0),:)=[];
for w=1:size(ECPP4,1)
IECPP4 (:,w)= ECPP4{w,1};
end
end
elseif recm(i,m,k)<0.1 && trecm(i,m,k) > 0.8;
% krecm(k)=k;
ECM{i,m,k}= Ecm{i,m,k};
aecm{i,m,k}= recm(i,m,k);
becm{i,m,k}=trecm(i,m,k);
cecm{i,m,k}=mrecm(i,m,k);
if i==1;
myECM1(k,m)= ECM(i,m,k);
myaecm1(k,m)=aecm{i,m,k};
mybecm1(k,m)=becm{i,m,k};
mycecm1(k,m)=cecm{i,m,k};
ECMId1 = ~cellfun('isempty', myECM1);
myECM1(find(sum(ECMId1,2)==0),:)=[];
%
ECM1=myECM1(:,m);
ECM1ID= ~cellfun('isempty', ECM1);
ECM1(find(sum(ECM1ID,2)==0),:)=[];
for w=1:size(ECM1,1)
IECM1 (:,w)= ECM1{w,1};
end
elseif i==2;
myECM2(k,m)= ECM(i,m,k);
myaecm2(k,m)=aecm{i,m,k};
mybecm2(k,m)=becm{i,m,k};
mycecm2(k,m)=cecm{i,m,k};
ECMId2 = ~cellfun('isempty', myECM2);
myECM2(find(sum(ECMId2,2)==0),:)=[];
%
ECM2=myECM2(:,m);
ECM2ID= ~cellfun('isempty', ECM2);
ECM2(find(sum(ECM2ID,2)==0),:)=[];
for w=1:size(ECM2,1)
IECM2 (:,w)= ECM2{w,1};
end
elseif i==3;
myECM3(k,m)= ECM(i,m,k);
myaecm3(k,m)=aecm{i,m,k};
mybecm3(k,m)=becm{i,m,k};
mycecm3(k,m)=cecm{i,m,k};
ECMId3 = ~cellfun('isempty', myECM3);
myECM3(find(sum(ECMId3,2)==0),:)=[];
%
ECM3=myECM3(:,m);
ECM3ID= ~cellfun('isempty', ECM3);
ECM3(find(sum(ECM3ID,2)==0),:)=[];
for w=1:size(ECM3,1)
IECM3 (:,w)= ECM3{w,1};
end
else%if i==4;
myECM4(k,m)= ECM(i,m,k);
myaecm4(k,m)=aecm{i,m,k};
mybecm4(k,m)=becm{i,m,k};
mycecm4(k,m)=cecm{i,m,k};
ECMId4 = ~cellfun('isempty', myECM4);
myECM4(find(sum(ECMId4,2)==0),:)=[];
%
ECM4=myECM4(:,m);
ECM4ID= ~cellfun('isempty', ECM4);
ECM4(find(sum(ECM4ID,2)==0),:)=[];
for w=1:size(ECM4,1)
IECM4 (:,w)= ECM4{w,1};
end
end
elseif recy(i,m,k)<0.1 && trecy(i,m,k) > 0.8;
% Krecy(k)=k;
ECY{i,m,k}= Ecy{i,m,k};
aecy{i,m,k}= recy(i,m,k);
becy{i,m,k}=trecy(i,m,k);
cecy{i,m,k}=mrecy(i,m,k) ;
if i==1;
myECY1(k,m)= ECY(i,m,k);
myaecy1(k,m)=aecy{i,m,k};
mybecy1(k,m)=becy{i,m,k};
mycecy1(k,m)=cecy{i,m,k};
ECYId1 = ~cellfun('isempty', myECY1);
myECY1(find(sum(ECYId1,2)==0),:)=[];
%
ECY1=myECY1(:,m);
ECY1ID= ~cellfun('isempty', ECY1);
ECY1(find(sum(ECY1ID,2)==0),:)=[];
for w=1:size(ECY1,1)
IECY1 (:,w)= ECY1{w,1};
end
elseif i==2;
myECY2(k,m)= ECY(i,m,k);
myaecy2(k,m)=aecy{i,m,k};
mybecy2(k,m)=becy{i,m,k};
mycecy2(k,m)=cecy{i,m,k};
ECYId2 = ~cellfun('isempty', myECY2);
myECY2(find(sum(ECYId2,2)==0),:)=[];
%
ECY2=myECY2(:,m);
ECY2ID= ~cellfun('isempty', ECY2);
ECY2(find(sum(ECY2ID,2)==0),:)=[];
for w=1:size(ECY2,1)
IECY2 (:,w)= ECY2{w,1};
end
elseif i==3;
myECY3(k,m)= ECY(i,m,k);
myaecy3(k,m)=aecy{i,m,k};
mybecy3(k,m)=becy{i,m,k};
mycecy3(k,m)=cecy{i,m,k};
ECYId3 = ~cellfun('isempty', myECY3);
myECY3(find(sum(ECYId3,2)==0),:)=[];
%
ECY3=myECY3(:,m);
ECY3ID= ~cellfun('isempty', ECY3);
ECY3(find(sum(ECY3ID,2)==0),:)=[];
for w=1:size(ECY3,1)
IECY3 (:,w)= ECY3{w,1};
end
else%if i==4;
myECY4(k,m)= ECY(i,m,k);
myaecy4(k,m)=aecy{i,m,k};
mybecy4(k,m)=becy{i,m,k};
mycecy4(k,m)=cecy{i,m,k};
ECYId4 = ~cellfun('isempty', myECY4);
myECY4(find(sum(ECYId4,2)==0),:)=[];
%
ECY4=myECY4(:,m);
ECY4ID= ~cellfun('isempty', ECY4);
ECY4(find(sum(ECY4ID,2)==0),:)=[];
for w=1:size(ECY4,1)
IECY4 (:,w)= ECY4{w,1};
end
end
elseif recmm(i,m,k)<0.1 && trecmm(i,m,k) > 0.8;
% krecmm(k)=k;
ECMM{i,m,k}= Ecmm{i,m,k};
aecmm{i,m,k}=recmm(i,m,k);
becmm{i,m,k}=trecmm(i,m,k);
cecmm{i,m,k}=mrecmm(i,m,k);
if i==1;
myECMM1(k,m)= ECMM(i,m,k);
myaecmm1(k,m)=aecmm{i,m,k};
mybecmm1(k,m)=becmm{i,m,k};
mycecmm1(k,m)=cecmm{i,m,k};
ECMMId1 = ~cellfun('isempty', myECMM1);
myECMM1(find(sum(ECMMId1,2)==0),:)=[];
%
ECMM1=myECMM1(:,m);
ECMM1ID= ~cellfun('isempty', ECMM1);
ECMM1(find(sum(ECMM1ID,2)==0),:)=[];
for w=1:size(ECMM1,1)
IECMM1 (:,w)= ECMM1{w,1};
end
elseif i==2;
myECMM2(k,m)= ECMM(i,m,k);
myaecmm2(k,m)=aecmm{i,m,k};
mybecmm2(k,m)=becmm{i,m,k};
mycecmm2(k,m)=cecmm{i,m,k};
ECMMId2 = ~cellfun('isempty', myECMM2);
myECMM2(find(sum(ECMMId2,2)==0),:)=[];
%
ECMM2=myECMM2(:,m);
ECMM2ID= ~cellfun('isempty', ECMM2);
ECMM2(find(sum(ECMM2ID,2)==0),:)=[];
for w=1:size(ECMM2,1)
IECMM2 (:,w)= ECMM2{w,1};
end
elseif i==3;
myECMM3(k,m)= ECMM(i,m,k);
myaecmm3(k,m)=aecmm{i,m,k};
mybecmm3(k,m)=becmm{i,m,k};
mycecmm3(k,m)=cecmm{i,m,k};
ECMMId3 = ~cellfun('isempty', myECMM3);
myECMM3(find(sum(ECMMId3,2)==0),:)=[];
%
ECMM3=myECMM3(:,m);
ECMM3ID= ~cellfun('isempty', ECMM3);
ECMM3(find(sum(ECMM3ID,2)==0),:)=[];
for w=1:size(ECMM3,1)
IECMM3 (:,w)= ECMM3{w,1};
end
else%if i==4;
myECMM4(k,m)= ECMM(i,m,k);
myaecmm4(k,m)=aecmm{i,m,k};
mybecmm4(k,m)=becmm{i,m,k};
mycecmm4(k,m)=cecmm{i,m,k};
ECMMId4 = ~cellfun('isempty', myECMM4);
myECMM4(find(sum(ECMMId4,2)==0),:)=[];
%
ECMM4=myECMM4(:,m);
ECMM4ID= ~cellfun('isempty', ECMM4);
ECMM4(find(sum(ECMM4ID,2)==0),:)=[];
for w=1:size(ECMM4,1)
IECMM4(:,w)= ECMM4{w,1};
end
end
end
end
end
end
% four related to four variables
myarcp1=myarcp1(any(myarcp1,2),:);
myarcp2=myarcp2(any(myarcp2,2),:);
myarcp3=myarcp3(any(myarcp3,2),:);
myarcp4=myarcp4(any(myarcp4,2),:);
myaecn1=myaecn1(any(myaecn1,2),:);
myaecn2=myaecn2(any(myaecn2,2),:);
myaecn3=myaecn3(any(myaecn3,2),:);
myaecn4=myaecn4(any(myaecn4,2),:);
myaecnn1=myaecnn1(any(myaecnn1,2),:);
myaecnn2=myaecnn2(any(myaecnn2,2),:);
myaecnn3=myaecnn3(any(myaecnn3,2),:);
myaecnn4=myaecnn4(any(myaecnn4,2),:);
myaecl1=myaecl1(any( myaecl1,2),:);
myaecl2=myaecl2(any( myaecl2,2),:);
myaecl3=myaecl3(any( myaecl3,2),:);
myaecl4=myaecl4(any( myaecl4,2),:);
myaecs1=myaecs1(any(myaecs1,2),:);
myaecs2=myaecs2(any(myaecs2,2),:);
myaecs3=myaecs3(any(myaecs3,2),:);
myaecs4=myaecs4(any(myaecs4,2),:);
myaecpp1=myaecpp1(any(myaecpp1,2),:);
myaecpp2=myaecpp2(any(myaecpp2,2),:);
myaecpp3=myaecpp3(any(myaecpp3,2),:);
myaecpp4=myaecpp4(any(myaecpp4,2),:);
myaecm1=myaecm1(any(myaecm1,2),:);
myaecm2=myaecm2(any(myaecm2,2),:);
myaecm3=myaecm3(any(myaecm3,2),:);
myaecm4=myaecm4(any(myaecm4,2),:);
myaecy1=myaecy1(any(myaecy1,2),:);
myaecy2=myaecy2(any(myaecy2,2),:);
myaecy3=myaecy3(any(myaecy3,2),:);
myaecy4=myaecy4(any(myaecy4,2),:);
myaecmm1=myaecmm1(any(myaecmm1,2),:);
myaecmm2=myaecmm2(any(myaecmm2,2),:);
myaecmm3=myaecmm3(any(myaecmm3,2),:);
myaecmm4=myaecmm4(any(myaecmm4,2),:);
%%%
mybrcp1=mybrcp1(any(mybrcp1,2),:);
mybrcp2=mybrcp2(any(mybrcp2,2),:);
mybrcp3=mybrcp3(any(mybrcp3,2),:);
mybrcp4=mybrcp4(any(mybrcp4,2),:);
mybecn1=mybecn1(any(mybecn1,2),:);
mybecn2=mybecn2(any(mybecn2,2),:);
mybecn3=mybecn3(any(mybecn3,2),:);
mybecn4=mybecn4(any(mybecn4,2),:);
mybecnn1=mybecnn1(any(mybecnn1,2),:);
mybecnn2=mybecnn2(any(mybecnn2,2),:);
mybecnn3=mybecnn3(any(mybecnn3,2),:);
mybecnn4=mybecnn4(any(mybecnn4,2),:);
mybecl1=mybecl1(any( mybecl1,2),:);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mybecl2=mybecl2(any( mybecl2,2),:);
mybecl3=mybecl3(any(mybecl3,2),:);
mybecl4=mybecl4(any( mybecl4,2),:);
mybecs1=mybecs1(any(mybecs1,2),:);
mybecs2=mybecs2(any(mybecs2,2),:);
mybecs3=mybecs3(any(mybecs3,2),:);
mybecs4=mybecs4(any(mybecs4,2),:);
mybecpp1=mybecpp1(any(mybecpp1,2),:);
mybecpp2=mybecpp2(any(mybecpp2,2),:);
mybecpp3=mybecpp3(any(mybecpp3,2),:);
mybecpp4=mybecpp4(any(mybecpp4,2),:);
mybecm1=mybecm1(any(mybecm1,2),:);
mybecm2=mybecm2(any(mybecm2,2),:);
mybecm3=mybecm3(any(mybecm3,2),:);
mybecm4=mybecm4(any(mybecm4,2),:);
mybecy1=mybecy1(any(mybecy1,2),:);
mybecy2=mybecy2(any(mybecy2,2),:);
mybecy3=mybecy3(any(mybecy3,2),:);
mybecy4=mybecy4(any(mybecy4,2),:);
mybecmm1=mybecmm1(any(mybecmm1,2),:);
mybecmm2=mybecmm2(any(mybecmm2,2),:);
mybecmm3=mybecmm3(any(mybecmm3,2),:);
mybecmm4=mybecmm4(any(mybecmm4,2),:);
%%
mycrcp1=mycrcp1(any(mycrcp1,2),:);
mycrcp2=mycrcp2(any(mycrcp2,2),:);
mycrcp3=mycrcp3(any(mycrcp3,2),:);
mycrcp4=mycrcp4(any(mycrcp4,2),:);
mycecn1=mycecn1(any(mycecn1,2),:);
mycecn2=mycecn2(any(mycecn2,2),:);
mycecn3=mycecn3(any(mycecn3,2),:);
mycecn4=mycecn4(any(mycecn4,2),:);
mycecnn1=mycecnn1(any(mycecnn1,2),:);
mycecnn2=mycecnn2(any(mycecnn2,2),:);
mycecnn3=mycecnn3(any(mycecnn3,2),:);
mycecnn4=mycecnn4(any(mycecnn4,2),:);
mycecl1=mycecl1(any( mycecl1,2),:);
mycecl2=mycecl2(any( mycecl2,2),:);
mycecl3=mycecl3(any( mycecl3,2),:);
mycecl4=mycecl4(any( mycecl4,2),:);
mycecs1=mycecs1(any(mycecs1,2),:);
mycecs2=mycecs2(any(mycecs2,2),:);
mycecs3=mycecs3(any(mycecs3,2),:);
mycecs4=mycecs4(any(mycecs4,2),:);
mycecpp1=mycecpp1(any(mycecpp1,2),:);
mycecpp2=mycecpp2(any(mycecpp2,2),:);
mycecpp3=mycecpp3(any(mycecpp3,2),:);
mycecpp4=mycecpp4(any(mycecpp4,2),:);
mycecm1=mycecm1(any(mycecm1,2),:);
mycecm2=mycecm2(any(mycecm2,2),:);
mycecm3=mycecm3(any(mycecm3,2),:);
mycecm4=mycecm4(any(mycecm4,2),:);
mycecy1=mycecy1(any(mycecy1,2),:);
mycecy2=mycecy2(any(mycecy2,2),:);
mycecy3=mycecy3(any(mycecy3,2),:);
mycecy4=mycecy4(any(mycecy4,2),:);
mycecmm1=mycecmm1(any(mycecmm1,2),:);
mycecmm2=mycecmm2(any(mycecmm2,2),:);
mycecmm3=myaecmm3(any(myaecmm3,2),:);
mycecmm4=myaecmm4(any(myaecmm4,2),:);
%% SAVING ALL DATAINTO EXCEL FILE
file1={'myarcp','mybrcp','mycrcp'};
file2={'myaecn','mybecn','mycecn'};
file3={'myaecnn','mybecnn','mycecnn'};
file4={'myaecl','mybecl','mycecl'};
file5={'myaecs','mybecs','mycecs'};
file6={'myaecpp','mybecpp','mycecpp'};
file7={'myaecm','mybecm','mycecm'};
file8={'myaecy','mybecy','mycecy'};
file9={'myaecmm','mybecmm','mycecmm'};
for p=1:length(files)
resulfile=files(p).name;
disp(resulfile)
for q=1:9 % number of interpolations
file=eval(strcat('file',num2str(q)));
disp(file)
for j=1:3 % number of variables and parameters one time when it run for 4 times
variable1 = eval(strcat(file{1},num2str(j)));
variable2 = eval(strcat(file{2},num2str(j)));
variable3 = eval(strcat(file{3},num2str(j)));
mytable = table(variable1,variable2,variable3)
writetable(mytable,strcat(resulfile(1:end-5),'_result','.xlsx'),'Sheet',num2str(q))
%clear variable1; clear variable2; clear variable3;
end
end
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!