MATLAB: In an assignment A(I) = B, the number of elements in B and I must be the same error.

the number of elements in b and i must be the same.

Hello, I am trying to make a script to use in some analysises but I have this "In an assignment A(I) = B, the number of elements in B and I must be the same" error. I think it is a common error. My codes are shown below. I have 3 data sets and it worked it 2 of them but the 3rd one giving that error to me. Error is in the line "N(j)=find(M~=0)". When I try to run the code, I=6042 logical, K=[31;32;33;34;35] , M=1095 logical, N=[109,250,486,744,750,1004], i=9 and j=4. I attached my data as .mat file. I have no idea why this code is not working. I really need help.
Good day
for i=1:numel(Full_Result.Nodes_Names)
I=strcmp(Full_Result.Nodes_Names{i, 1},Network.Nodes);
Full_Result.Nodes_NEdges(i)=sum(I);
%Listedeki Hangi metabolitlerle eşlesiyor
K=find(I~=0);
Full_Result.ESC{i,1}=Network.Edges(K',1);
for j=1:numel(K)
M=strcmp(Network.Edges{K(j),1},Pvalues.Edges);
N(j)=find(M~=0);
end
%Calculate the aggregated Z-score for the metabolite
Full_Result.Nodes_ZScores(i)=sum(Pvalues.Zscores(N))/sqrt(numel(N));
Full_Result.Nodes_meanZ(i)=mean(Pvalues.Zscores(N));
Full_Result.Nodes_stdZ(i)=std(Pvalues.Zscores(N));
end

Best Answer

load error_matrixes
for i=1:numel(Full_Result.Nodes_Names)
I=strcmp(Full_Result.Nodes_Names{i, 1},Network.Nodes);
Full_Result.Nodes_NEdges(i)=sum(I);
%Listedeki Hangi metabolitlerle eşlesiyor
K=find(I~=0);
Full_Result.ESC{i,1}=Network.Edges(K',1);
N=cell(1);
for j=1:numel(K)
M=strcmp(Network.Edges{K(j),1},Pvalues.Edges);
N{j}=find(M~=0);
end
%Calculate the aggregated Z-score for the metabolite
Full_Result.Nodes_ZScores(i)=sum(Pvalues.Zscores(N{j}))/sqrt(numel(N));
Full_Result.Nodes_meanZ(i)=mean(Pvalues.Zscores(N{j}));
Full_Result.Nodes_stdZ(i)=std(Pvalues.Zscores(N{j}));
end