File Exchange

image thumbnail


version 1.0 (1.24 KB) by

Converts all numeric variables in the workspace, or optionally all doubles only, to single precision



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)

Jan Simon

Jan Simon (view profile)

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
MATLAB 8.0 (R2012b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today