The aim is to create a matrix (C_n) from two different matrices (M) and (t_e1) using a equality condition. I am trying to use the following code to do this. However,it gives me output as a matrix with zeros.
C_n=zeros(length(M),length(int));
for i= 1:length(int)
for j=1:length(M)
if M(j,i)==t_e1(j,1)
C_n(j,i)=t_e1(j,2);
end
end
end
What am I doing wrong in the above code?? Also, is there a better way to do get the required output (not using loops)?
Thank you!
0 件のコメント
サインインしてコメントする。