scientific notation
15 ビュー (過去 30 日間)
古いコメントを表示
i dont know why but matlab is printing out my y values in scientific notation which i do not want, how do i do that?
disp('table of degrees to radians')
disp(' degrees radians')
for i=0:1:36
x=5*i;
y=x*pi/180;
fprintf('\n %i %i',x,y);
end
0 件のコメント
採用された回答
その他の回答 (2 件)
the cyclist
2011 年 8 月 1 日
disp('table of degrees to radians')
disp(' degrees radians')
for i=0:1:36
x=5*i;
y=x*pi/180;
fprintf('\n %i %f',x,y); % Changed to %f
end
1 件のコメント
Jan
2011 年 8 月 1 日
The %i format displays integer values as integers, but for fractional parts the scientific notation is used. If I understand you correctly, you want to display integer values for a non-integer DOUBLE:
for i=0:1:36
x = 5*i;
y = x*pi/180;
fprintf('\n %i %.0f', x, y);
% or: fprintf('\n %i %i', x, round(y));
end
See also: FLOOR, FIX.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!