MATLAB: Does the Fixed-Point Toolbox 1.1 (R14SP1) run so slow

fifixed-pointfixedpointperformanceslowtoolbox

When I use fixed-point (fi) objects, my code runs very slowly. For example, if I run the following code
a = fi(0,1,8);
for x=1:100000
a.data = 1;
end
it takes a long time to run. The Profiler shows that most of the processing time is spent in calls to the embedded.fi function.

Best Answer

This enhancement has been incorporated in Release 2008b (R2008b). For previous product releases, you can try to do most of your updates using floating-point numbers (e.g. double) and assign only the final result to a fixed-point object.
Another option is to do the assignments directly between fixed-point objects. For the given example, you can do the following:
a = fi(0,1,8);
b = fi(1,1,8);
for x=1:100000
a = b;
end
This code runs much faster because it is not creating a new instance of the fixed-point object each time through the loop.
You can also use EMLMEX to speed up fixed point execution as given in the following help documentation:
<http://www.mathworks.com/access/helpdesk/help/toolbox/fixedpoint/ug/bq4csxw.html#brli0za>