소스 검색

Add input waveform sanitization regex.

keep-around/c5216e76cad262723738e350daf9fd25abbc8ea7
Mickey Derks 8 년 전
부모
커밋
c5216e76ca
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. +18
    -0
      OOequipment/FunctionGenerator.m

+ 18
- 0
OOequipment/FunctionGenerator.m 파일 보기

@@ -12,7 +12,25 @@ classdef FunctionGenerator < Equipment
end
methods
function wf = get.waveform(fg)
wf = fg.query('FUNCtion:SHAPe?')
end
end
methods (Static)
function wf = getWave(inwf)
wf = regexp(inwf, '(?i)(si|sq|[trndu1-7]|s)', 'match', 'once');

if isempty(wf)
error('Invalid waveform.');
end

wf = regexprep(wf, {'^(1|si|(?-i)s)$', '^(2|sq|(?-i)S)$', '^[3t]$', '^[4r]$', '^[5n]$', '^[6d]$', '^[7u]$'}, ...
{'sinusoid', 'square', 'triangle', 'ramp', 'noise', 'dc', 'user'}, 'ignorecase');

end
end
end


불러오는 중...
취소
저장