求matlab程序for循环中怎么保存中间变量
下面这段程序中我想把t1,t2,tim_indx每次循环的结果分别保存下来怎么办?forx=1:x_lenforz=1:z_lentmp=0;fori=1:ele_num...
下面这段程序中我想把t1,t2,tim_indx每次循环的结果分别保存下来怎么办?
for x=1:x_len
for z=1:z_len
tmp=0;
for i=1:ele_number
for j=1:ele_number
focus_position=[x_pos(x),z_pos(z)];
t1 = Ferrari(j,ele_position,focus_position,wedge_velocity ,block_velocity);
t2= Ferrari(i,ele_position,focus_position,wedge_velocity ,block_velocity);
t=t1+t2;
tim_indx = round(t/sig_tres); %计算索引
if tim_indx<1
tim_indx = 1;
end
tmp=tmp+wedge_fmc_data((i-1)*ele_number+j,tim_indx);
end
end 展开
for x=1:x_len
for z=1:z_len
tmp=0;
for i=1:ele_number
for j=1:ele_number
focus_position=[x_pos(x),z_pos(z)];
t1 = Ferrari(j,ele_position,focus_position,wedge_velocity ,block_velocity);
t2= Ferrari(i,ele_position,focus_position,wedge_velocity ,block_velocity);
t=t1+t2;
tim_indx = round(t/sig_tres); %计算索引
if tim_indx<1
tim_indx = 1;
end
tmp=tmp+wedge_fmc_data((i-1)*ele_number+j,tim_indx);
end
end 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询