How to force MATLAb to use 32bit floating-point numbers in a script?
26 次查看(过去 30 天)
显示 更早的评论
Is it possible to use 32bit precision thru a script or part of the script without editing the whole code?
2 个评论
John D'Errico
2018-4-17
No. You cannot simply tell MATLAB to change precision from outside the code.
dpb
2018-4-17
On top of which, you can't define a default precision for a script within a script or function file; you can only cast to a given precision on assignment and then ensure all variables in all related calculations are also of same class or follow other strict rules to avoid results being default doubles.
回答(1 个)
Walter Roberson
2018-4-17
编辑:dpb
2018-4-17
Yes, but only on MS Windows
https://www.mathworks.com/matlabcentral/answers/47142-how-to-set-matlab-precision-to-single
1 个评论
dpb
2018-4-17
Doesn't it only control the rounding mode? I couldn't demonstrate to my satisfaction that it actually did anything discernible in R2016b here; seems like in times gone by one could see the effect but I've forgotten the details of how/what did those many years ago...
I'm presuming the OP wants to actually have everything only take up single precision in memory as well???
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!