📄 store_esg_sequences.m
字号:
%=============================================================================
%
% LTD DSP Software Schaumburg, IL.
%
% COPYRIGHT 2006 Motorola, Inc.
%
% All Rights Reserved
%
%------------------------------- Module Name ---------------------------------
%
% Module Name: store_esg_sequences.m
%
% Original Author: Mphahlele Moruthane
%
% Date of Origin (MM/DD/YY): 09/01/2006
%
%-------------------------------- Revisions ----------------------------------
%
% Person Date Comments
%
% 09/01/2006 - moruthane - created
%
%----------------------- Detailed Design Description -------------------------
%
% Reads an ASCII text file containing a list of ESG waveform filenames
% and creates a sequence of those waveforms in the ESG.
%
% Assumptions:
% ESG waveforms specified in sequences have already been stored in the ESG.
%
% Inputs:
% sequence_list_filename - name of file containing list of sequences
% 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 store_esg_sequences(sequence_list_filename, esg_gpib_addr)
%=============================================================================
% Open file
%=============================================================================
fid = fopen(sequence_list_filename, '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 sequence_list filename
[ input_file_dir filename ext ] = fileparts(sequence_list_filename);
for i=1:2:number_of_filenames(1),
% assume all files are in same dir as sequence_list_filename
sequence_pathname = [ input_file_dir '/' char(filename_cell_array(i)) ];
write_sequence_to_esg(esg_gpib_addr,char(filename_cell_array(i+1)),read_input_payload(sequence_pathname),1);
end
%=============================================================================
% Close files
%=============================================================================
fclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -