524 Accelerating MATLAB
®
Performance
undocumented and unsupported function that can change without prior notice in new
MATLAB releases:
% Prepare the data vector
v = java.util.Vector;
for idx=1:10000, v.add(idx); end %10K elements
% Using the standard toArray() and cell() functions
data = reshape(cell(v.toArray),[],20); % => 500x20 cell array
⇨ Elapsed time is 0.063515 seconds.
% Using the undocumented feature(44,...) function – 5x faster
data = feature(44,v,20);
⇨ Elapsed time is 0.012380 seconds.