filetimes.m

来自「基于声源的方向定位程序」· M 代码 · 共 40 行

M
40
字号
% This script loads data from files, if the files haven't been read yet.% On input, these variables must be set:%%    arrfile	file name of array phone positions; positions should be %               in columns of x and y%    arrcols	which columns of arrfile to use (normally just [1 2])%    timefile	arrival times at each phone (s)%    p		phones to use%% After execution, these are set:%%    arr	the array%    arrivals	times of arrivalif (~exist('prevarrfile')),  prevarrfile  = ''; endif (~exist('prevtimefile')), prevtimefile = ''; enddisp(sprintf('Arrival times are from %s.', timefile));if (~strcmp(timefile, prevtimefile))  disp('Loading...');  arrivals = loadascii(timefile);  prevtimefile = timefile;enddisp(sprintf('Array positions are from %s.', arrfile));if (~strcmp(arrfile, prevarrfile))  disp('Loading...');  arr = loadascii(arrfile);  arr = arr(:, arrcols).';			% pick off desired columns  if (size(arr,1) < 2), arr(2,1) = 0; end	% change 1-dim array to 2-dim  prevarrfile  = arrfile;endif (~strcmp(p, 1:length(arr)))		% not strings, but strcmp still works  disp(sprintf('Using phones [%d%s] from this array.', ...      p(1), sprintf(' %d',p(2:length(p)))));end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?