📄 process_input_waveform.m
字号:
%=============================================================================
%
% LTD DSP Software Schaumburg, IL.
%
% COPYRIGHT 2006 Motorola, Inc.
%
% All Rights Reserved
%
%------------------------------- Module Name ---------------------------------
%
% Module Name: process_input_waveform.m
%
% Original Author: Michael Laginess
%
% Date of Origin (MM/DD/YY): 07/12/2006
%
%-------------------------------- Revisions ----------------------------------
%
% Person Date Comments
%
% 07/12/2006 - laginess - created
%
%----------------------- Detailed Design Description -------------------------
%
% Accepts input wavefile in ASCII format. Converts wavefile to a string of
% input bits. Sends converted waveform to ESG for execution.
%
% Assumptions:
% File format consists of data in ASCII hex.
%
% Inputs:
% input_wavefile_name - name of file where input filelist is stored.
% 0 = 'default_wavefile_list.txt'
% esg_gpib_addr - GPIB address of ESG
%
% Notes:
% Input Wavefile Format:
% The following is the format used for the input wavefile. This
% format MUST be followed for the process_input_waveform function to
% operate. Note that the filenames themselves are not limited to the
% format in the below example and are not case sensitive.
%
% Example: default_wavefile_list.txt
% |---------------------------------------------------------------|
% input_test_filename_1.txt
% ESG_WAVEFILE_NAME_1
% input_test_filename_2.txt
% ESG_WAVEFILE_NAME_2
% etc...
% |---------------------------------------------------------------|
%
% Outputs:
% Wavefiles listed in the input file will be loaded onto the ESG
%
%=============================================================================
function process_input_waveform(input_wavefile_name, esg_gpib_addr)
if input_wavefile_name == 0
input_wavefile_name = 'default_wavefile_list.txt';
end
%=============================================================================
% Open file
%=============================================================================
fid = fopen(input_wavefile_name, 'r');
%=============================================================================
% Read data
%=============================================================================
% read entire ASCII file
file_input_data = fread(fid, 'uchar');
fclose(fid);
% make sure input data is 1 row
[ nr, nc ] = size(file_input_data);
ascii_input_data = reshape(file_input_data, 1, nr*nc);
%Initialize the file character markers
j=1;
k=1;
%Step through all the characters in the file and pull out the file names,
%which are seperated by the carriage return sequence(13 10). The file names
%are stored row by row, character by character.
for i=1:nr
if ascii_input_data(i) ~= 13
if ascii_input_data(i) ~= 10
filename_char_array(j,k) = ascii_input_data(i);
k = k+1;
end
else
j = j+1;
k = 1;
end
end
%The rows of file name characters are condensed to single cells.
filename_char_array = char(filename_char_array);
filename_cell_array = cellstr(filename_char_array);
number_of_filenames = size(filename_cell_array);
%For every file listed, send the contents to the ESG with the user defined
%filename and slot setup.
% get dirname of input wave filename
[ input_file_dir filename ext ] = fileparts(input_wavefile_name);
for i=1:2:number_of_filenames(1),
% assume all files are in same dir as input_wavefile_name
waveform_pathname = [ input_file_dir '/' char(filename_cell_array(i)) ];
esg_input_payload = read_input_payload(waveform_pathname);
write_waveform_to_esg(esg_gpib_addr,char(filename_cell_array(i+1)),esg_input_payload,1);
end
%=============================================================================
% Close files
%=============================================================================
fclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -