% 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
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.