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

    %% Write uint8 Data to Binary File
% Open a file named |nine.bin| for writing. Specify write access using
% |'w'| in the call to |fopen|.

% Copyright 2015 The MathWorks, Inc.

fileID = fopen('nine.bin','w');
%%
% |fopen| returns a file identifier, |fileID|.
%%
% Write the integers from 1 to 9 as 8-bit unsigned integers.
fwrite(fileID,[1:9]);
%%
% Close the file.
fclose(fileID);