瀏覽代碼

Class update met beep, isnum, clear en opc-functies

keep-around/c5216e76cad262723738e350daf9fd25abbc8ea7
Wouter Horlings 8 年之前
父節點
當前提交
ebf8f6f9e0
共有 1 個檔案被更改,包括 30 行新增0 行删除
  1. +30
    -0
      OOequipment/Equipment.m

+ 30
- 0
OOequipment/Equipment.m 查看文件

@@ -23,10 +23,34 @@ classdef Equipment < handle
id = ecq.query('*idn?'); id = ecq.query('*idn?');
end end
function clear(ecq)
ecq.write('*cls');
end
function opc(ecq)
ecq.query('*OPC?');
end
function unlock(ecq) function unlock(ecq)
if ecq.channel >= 0
fprintf(ecq.tcp,'++loc');
ecq.locked = false;
else
warning('Device does not support unlocking')
end
end end
function lock(ecq) function lock(ecq)
if ecq.channel >= 0
fprintf(ecq.tcp,'++llo');
ecq.locked = true;
else
warning('Device does not support locking')
end
end
function beep(ecq)
ecq.write('SYST:BEEP')
end end
function delete(ecq) function delete(ecq)
@@ -57,6 +81,8 @@ classdef Equipment < handle
function e = get.error(ecq) function e = get.error(ecq)
e = ecq.query('SYSTem:ERRor?'); e = ecq.query('SYSTem:ERRor?');
end end
end end
methods (Static) methods (Static)
function tcpobject = getTCP(ipAddress,port) function tcpobject = getTCP(ipAddress,port)
@@ -87,6 +113,10 @@ classdef Equipment < handle
end end
end end
function bool = isnum(input)
bool = isnumeric(input)&&isscalar(input);
end
function iptest(ipAddress) function iptest(ipAddress)
validip = regexp(ipAddress,'^(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))$', 'once'); validip = regexp(ipAddress,'^(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))$', 'once');
if isempty(validip) if isempty(validip)


Loading…
取消
儲存