Up to now, I used 3 loops to build a matrix, but it takes such a long time that I would like to vectorize it. But either it's not possible, or I took the wrong way to do it. Anyway, I am in front of a wall, and I need your help.
Here are the loops :
AngleList = [0 : 10 : 300]; % 31 elements
Fx_mat is a (1000,120,31) matrix, 31 is for the 31 elements corresponding to AngleList.
for Aaa = 1:Nb_loop1 % Nb_loop1 = 3
for Bbb = 1:Nb_loop2 % Nb_loop2 = 120
for Ccc = 1:Nb_loop3 % Nb_loop3 = 1000
Angle = rand()*300; % Then Angle is between 0 and 300
Fx_mat_interp(Aaa,Bbb,Ccc) = interp1(AngleList, Fx_mat(Ccc,Bbb,:), Angle);
end
end
end
What I first tried to do is to create matrix with my datas :
m_Angle = rand(Nb_loop3,Nb_loop2)*300 % 1000x120 matrix
m_AngleList = permute(reshape(repmat(AngleList,Nb_loop3,Nb_loop2),Nb_loop1,Nb_loop3,Nb_loop2),[1 3 2]);
% I repeat my AngleList vector in a 1000x120x31 matrix
for Aaa = 1:Nb_loop1
Fx_mat_interp(Aaa,:,:) = ?????(m_AngleList, Fx_mat(Nb_loop3,Nb_loop2,:), m_Angle);
end
I would like to replace ????? with the equivalent to interp1, but I can't find it.
Do you have any idea to help me please ?
P.S: And a lot of great thinks for all of you for this new year.