Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 295
Creating and Downloading Waveform Files
Programming Examples
buf = floor(bufSize/format);
fullChunks = floor(length(data)/buf);
partialChunk = length(data)-(fullChunks*buf);
sfmt = 'int32';
if format==1
sfmt = 'int8';
elseif format==2
sfmt = 'int16';
end
stop=0;
for i=0:(fullChunks-1)
start = 1+(i*buf);
stop = (i+1)*buf;
fwrite(fid,data(start:stop),sfmt);
end
if partialChunk>0
fwrite(fid,data(stop+1:end),sfmt);
end
end
function [data, rms] = FormatWaveform( iqWave )
% Scale the waveform to DAC values
[a,b] = size(iqWave);
if a>b
iqWave = iqWave';
end
maxV = max(abs([real(iqWave) imag(iqWave)]));
if maxV==0 maxV=1; end % Prevent divide by zero
scale = 32767/maxV;
iqWave = round( scale*iqWave );
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...