ecoc measurements
This commit is contained in:
@@ -53,7 +53,29 @@ classdef OptAtten < handle
|
||||
|
||||
try
|
||||
%connect to device
|
||||
v = visadev('TCPIP::134.245.243.248::INSTR');
|
||||
ipAddress = 'TCPIP::134.245.243.248::INSTR';
|
||||
maxRetries = 5;
|
||||
pauseTime = 2; % seconds between retries
|
||||
|
||||
v = [];
|
||||
success = false;
|
||||
|
||||
for attempt = 1:maxRetries
|
||||
try
|
||||
v = visadev(ipAddress);
|
||||
success = true;
|
||||
|
||||
break; % Exit loop if successful
|
||||
catch ME
|
||||
fprintf('Connection attempt %d failed: %s\n', attempt, ME.message);
|
||||
pause(pauseTime);
|
||||
end
|
||||
end
|
||||
|
||||
if ~success
|
||||
error(' Could not connect to device after %d attempts.', maxRetries);
|
||||
end
|
||||
|
||||
|
||||
debug = 0;
|
||||
if debug
|
||||
@@ -315,7 +337,8 @@ classdef OptAtten < handle
|
||||
p3 = obj.power_state(3);
|
||||
p4 = obj.power_state(4);
|
||||
|
||||
if options.silent == 0
|
||||
delete(v);
|
||||
if options.silent ~= 0
|
||||
fprintf("\n CH1: %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n \n",p1, p2, p3, p4);
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user