How can I convert a variable whose value is double to integer or to float?
130 次查看(过去 30 天)
显示 更早的评论
How can I convert a variable whose value is double to integer or to float? So I think I can fix the problem:
Undefined function 'roundn' for input arguments of type 'double'.
Error in plot_litho_061015 (line 58) drawLine([0 roundn(z1),2], [0 min(z1)]); hold on; % Vertical line at x = 0;
ps: z1 value= 2601x1double
0 个评论
采纳的回答
bio lim
2015-7-21
z1 = rand(2601,1);
int_z1 = int8(z1);
I don't really understand what you mean by "float". Are you refering to single-precision? If so,
single(z1)
In general, MATLAB functions usually require doubles.
1 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!