Keysight E4428C ESG RF Programming Manual page 303

Signal generators
Table of Contents

Advertisement

WriteData(t,mkrData,1,bufSize);
fprintf(t,'\n');
fprintf(t,'syst:err?');
fgets(t)
fprintf(t,'%s\n',hdrCmd);
fprintf(t,'syst:err?');
fgets(t)
fclose(t);
end
function WriteData(fid,data,format,bufSize)
% Write data using a loop to support large waveforms without having to
% specify a huge buffer.
%
% INPUT PARAMETERS:
%
fid
- file id
%
data
- all the data
%
format
- data size to output in bytes 1,2,4 etc.
%
bufSize
- Buffer size in bytes
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
Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
295

Advertisement

Table of Contents
loading

Table of Contents