File Exchange

image thumbnail


version (1.24 KB) by Ben Barrowes
Converts all numeric variables in the workspace, or optionally all doubles only, to single precision


Updated 21 Feb 2013

View License

% 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

Comments and Ratings (1)


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.

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux