EasyManua.ls Logo

Agilent Technologies E4438C - Appendix

Agilent Technologies E4438C
48 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
46
www.agilent.com/find/esg
An example MATLAB
®
program to generate and save a user data file is shown below.
%************************************ Userdata File Example************************
% Set some constant parameters
numBytes = 16;
bitsPerByte = 8;
% Construct a bit stream
databits = ones(1,numBytes*bitsPerByte); % Sets entire stream to 1's
databits(11:2:29) = 0; % Set some alternating bits to 0's
databits(51:70) = 0; % Set a block of bits to 0's
% Convert from an array of bits to an array of bytes
databytes = ones(bitsPerByte, length(databits)/bitsPerByte); % Make array 8 x N/8
databytes(:) = databits; % Each column is 1 byte = 8 bits
c = [128 64 32 16 8 4 2 1]; % Weight according to bit position
data = c*databytes; % Change to decimal
fid = fopen('Userdata','w'); % Open a file named Userdata
fwrite(fid, data, 'uint8'); % Write the data to the file
fclose(fid); % Close the file
%***********************************************************************************
Appendix

Other manuals for Agilent Technologies E4438C

Related product manuals