www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SinglePrecisionInputTreatedasDoubleExample.m

    %% Single-Precision Input Treated as Double  

%% 
% Create a 3-by-3 array of single-precision values. 
A = single([1200 1500 1800; 1300 1600 1900; 1400 1700 2000])  

%% 
% Find the product of the elements in each row by multiplying in double
% precision. 
B = prod(A,2,'double')  

%% 
% The output is double precision. 
class(B)