"Matt J" wrote in message <jcstks$mms$
1...@newscl01ah.mathworks.com>...
Hi Matt,
Can you help me with improving the performance for my Matlab code. I am trying to fetch stored data from a NxNx300 cell array one at a time to perform a multiplication operation. I have three big matrices. T1=T2=T3=NxNx300 sample points. So, I would like to perform T=T1*T2*T3 by fetching one value each from T1, T2 and T3.
sampleSize=300;
cell_size=676;
trans_matrix_size=2*cell_size;
nx1=nx2=0;
ny1=ny2=ny3=ny4=0;
for x=1:1:sampleSize
for mrow=1:1:trans_matrix_size
if(mrow <= cell_size)
nx1=nx1+1;
else
nx2=nx2+1;
end
for mcol=1:1:trans_matrix_size
if(mcol <= cell_size && mrow <= cell_size)
ny1=ny1+1;
ny3=0;
mat_A(mrow,mcol)=TA{nx1,ny1}(x);
mat_B(mrow,mcol)=TA{nx1,ny1}(x);
mat_C(mrow,mcol)=TA{nx1,ny1}(x);
elseif(mcol <= cell_size && mrow > cell_size) % Element a21
ny2=ny2+1;
ny4=0;
mat_A(mrow,mcol)=TC{nx2,ny2}(x);
mat_B(mrow,mcol)=Y{nx2,ny2}(x);
mat_C(mrow,mcol)=TC{nx2,ny2}(x);
elseif(mcol > cell_size && mrow <= cell_size)
ny3=ny3+1;
ny1=0;
mat_A(mrow,mcol)=TB{nx1,ny3}(x);
mat_B(mrow,mcol)=TC{nx1,ny3}(x);
mat_C(mrow,mcol)=TB{nx1,ny3}(x);
elseif(mcol > cell_size && mrow > cell_size)
ny4=ny4+1;
ny2=0;
mat_A(mrow,mcol)=TA{nx2,ny4}(x);
mat_B(mrow,mcol)=TA{nx2,ny4}(x);
mat_C(mrow,mcol)=TA{nx2,ny4}(x);
end
end
end
end
Thanks for helping out...