www.gusucode.com > fixedpoint 案例源码程序 matlab代码 > fixedpoint/CreateArrayofOneswithAttachedfimathExample.m
%% Create Array of Ones with Attached fimath %% % Create a signed |fi| object with word length of 16, fraction length of % 15 and |OverflowAction| set to |Wrap|. format long p = fi([],1,16,15,'OverflowAction','Wrap'); %% % Create a 2-by-2 array of ones with the same |numerictype| properties as |p|. X = ones(2,'like',p) %% % 1 cannot be represented by the data type of |p|, so the value saturates. % The output |fi| object |X| has the same |numerictype| and |fimath| properties % as |p|.