288 Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files 
Programming Examples 
if FID == -1 error('Cannot Open File'); end
[internalWave,n] = fread(FID, 'uint16');% read the IQ file 
fclose(FID);% close the file
internalWave = internalWave';   % Conver from column array to row array
% If on a PC swap the bytes back to Little Endian
if strcmp( computer, 'PCWIN' )  % Put the bytes into the correct order
    internalWave= bitor(bitshift(internalWave,-8),bitshift(bitand(internalWave,255),8));
end
% convert unsigned to signed representation
internalWave = double(internalWave);
tmp = (internalWave > 32767.0) * 65536;
iqWave = (internalWave - tmp) ./ 32767;  % and normalize the data
% De-Interleave the IQ data 
IwaveIn = iqWave(1:2:n);
QwaveIn = iqWave(2:2:n);