% TOSINGLE - toSingle(doublesOnly)
% Converts all numerical variables in the calling
% workspace to single precision
% If doublesOnly is nonzero, then it converts only
% the doubles in the calling workspace to singles
Ben Barrowes (2021). toSingle (https://www.mathworks.com/matlabcentral/fileexchange/40444-tosingle), MATLAB Central File Exchange. Retrieved .
The dynamic change of the types will reduce the memory footprint of a function, but it is very likely that the processing time will grow: Matlab's JIT acceleration is impeded by such dynamic changes. Some functions need 100 times longer afterwards compared to a explicit and direct creation of the variables in the wanted class.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!