www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/ChangeTheEndiannessOfTheDataBeforeWritingTheDataExample.m
%% Change the Endianness of the Data Before Writing the Data % By default, the |dsp.BinaryFileWriter| System object(TM) uses the % endianness of the host machine. To change the endianness, use the % |swapbytes| function. %% % Write a numeric array into |myfile.dat| using the |dsp.BinaryFileWriter| % object. Before writing the data, change the endianness of the data using % the |swapbytes| function. data = [1 2 3 4 2 2]; swapData = swapbytes(data); writer = dsp.BinaryFileWriter('myfile.dat'); writer(swapData);