Is it possible to set SINGLE PRECISION as default for a hole program?

31 ビュー (過去 30 日間)
Andrea Zanichelli
Andrea Zanichelli 2017 年 1 月 15 日
コメント済み: Stavros Skouras 2017 年 4 月 20 日
I need to have all the variables in my program with a single precision. How can I set it as default, for avoiding to use the command 'single' for each of my variables?

回答 (1 件)

Jyotish Robin
Jyotish Robin 2017 年 1 月 18 日
By default, MATLAB stores all numeric values as double-precision floating point. You cannot change the default type and precision.
But still you may be able to generate single-precision MATLAB code from double-precision MATLAB code. This may require MATLAB Coder and Fixed-Point Designer along with MATLAB.
You can take a look at the following link fore more info:
Hope this helps !
  1 件のコメント
Stavros Skouras
Stavros Skouras 2017 年 4 月 20 日
Hi Robin,
Can one follow the process suggested in your link even when if the program depends on extensive (third-party) Matlab toolboxes (SPM in this case: )
I am looking for a way to speed things up, in case you have some other suggestions.
Many thanks and best wishes, Stavros


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by