MATLAB calculation bug in loop
显示 更早的评论
for t_temp=0:1/250/1000:3/250
Te_temp = subs(Te,t,t_temp);
Te_temp = double(Te_temp);
Te_array = [Te_temp Te_array];
precent = ((t_temp)/(3/250))*100;
% if percent>10*cnt
% cnt=cnt+1;
fprintf("%f%%\n",percent);
% fprintf("%f%%\n",t_temp/(3/250)*100);
% end
end
Hi, I have a question about calculation bug in MATLAB.
I want to check progress of the loop, so I calculate the percent separately as "percent" variable.
But the result is 0.00000 .
If I print the value which is calculated directly such as "fprintf("%f%%\n", t_temp/(3/250)*100)";,
It works!!! I don't know the difference these two statement.
Are there any other who have this problem?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!