diff --git a/Utility functions/Unused/findTcpipInstruments.m b/Utility functions/Unused/findTcpipInstruments.m deleted file mode 100644 index 1a6b7f6..0000000 --- a/Utility functions/Unused/findTcpipInstruments.m +++ /dev/null @@ -1,34 +0,0 @@ -% Pings all the IP addresses assuming the subnet mask 255.255.255.000 -% Local IP is a string of dot-separated decimals like '192.168.1.8' -% Caution: very slow, use the 'ind' option for partial search -function rsc_list = findTcpipInstruments(local_ip, varargin) - p=inputParser(); - addParameter(p,'ind',[1,254], @(x) validateattributes(x, {'numeric'},... - {'integer','nondecreasing','>',1,'<',254})); - addParameter(p,'visa_adaptor','ni',@ischar); - parse(p,varargin{:}); - v_ad = p.Results.visa_adaptor; - - a = sscanf(local_ip,'%i.%i.%i.%i'); - rsc_list = {}; - % Do full search. 0 and 255 are not valid as host names - disp('Found TCPIP-VISA instruments:'); - for i=p.Results.ind(1):p.Results.ind(2) - ip = sprintf('%i.%i.%i.%i',a(1),a(2),a(3),i); - rsc_name = sprintf('TCPIP0::%s::inst0::INSTR',ip); - % Try to connect to the device and open it - tmp_dev = visa(v_ad,rsc_name); %#ok - try - fopen(tmp_dev); - fclose(tmp_dev); - % If the fopen operation was successful, add the IP to ip_list - rsc_list = [rsc_list,sprintf('visa(''%s'',''%s'');',... - v_ad,rsc_name)]; %#ok - disp(rsc_name); - catch - % If error - do nothing - end - delete(tmp_dev); - end -end - diff --git a/Utility functions/Unused/getLocalIP.m b/Utility functions/Unused/getLocalIP.m deleted file mode 100644 index 4faa7b6..0000000 --- a/Utility functions/Unused/getLocalIP.m +++ /dev/null @@ -1,31 +0,0 @@ -% get the IP addresses of this computer on local networks -function ip_list = getLocalIP() - % Regex to match IP address, e.g 192.168.1.8 - % Each of the 4 blocks match dot-separated numbers and read as - % ('25x', where x=0 to 5) or ('2xy' where x=0 to 4 and y=0 to 9) or - % (zyx where z=0,1 or nothing; y=0 to 9; x=0 to 9 or nothing) - % The 4 blocks are peceeded and followed by non-numeric characters - ip_regex = ['(\D)',... - '(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]?)(\D)']; - instr_info = instrhwinfo('tcpip'); - ip_list = cell(1,length(instr_info.LocalHost)); - for i=1:length(instr_info.LocalHost) - tmp_ip=regexp([' ',instr_info.LocalHost{i},' '],ip_regex,'match'); - if length(tmp_ip)>=1 - % if a match is found, assign it to the output disregarding the - % first and the last separating characters - ip_list{i}=tmp_ip{1}(2:end-1); - if length(tmp_ip)>1 - warning('Multiple IP''s are matched by regex') - end - else - ip_list{i}=''; - end - end - % Discard all the empty cells - ip_list = ip_list(~cellfun(@isempty,ip_list)); -end - diff --git a/Utility functions/testfit.m b/Utility functions/testfit.m deleted file mode 100644 index 69a200b..0000000 --- a/Utility functions/testfit.m +++ /dev/null @@ -1,56 +0,0 @@ -%Testing tool for MyFit -clear -close(figure(1)) -x_vec=linspace(0,200,1000); - -% testFit=MyFit('fit_name','Linear','enable_gui',1); -testFit=MyGorodetsky2000Fit(); -params=cell(1,testFit.n_params); -switch testFit.fit_name - case 'Lorentzian' - for i=1:testFit.n_params - params{i}=5*rand; - params{3}=200*rand; - end - case 'Exponential' - params{1}=+5*rand; - params{2}=-0.1*rand; - params{3}=0.01*rand; - case 'Linear' - params{1}=10*rand; - params{2}=-50*rand+25; - case 'DoubleLorentzian' - for i=1:testFit.n_params - params{i}=5*rand; - end - params{3}=50+10*rand; - params{2}=params{5}; - params{6}=50+100*rand; - case 'Gorodetsky2000' - for i=1:testFit.n_params - params{i}=5*rand; - end - params{3}=0.001*rand; - params{2}=80+20*rand; - params{4}=5+10*rand; - otherwise - for i=1:testFit.n_params - params{i}=5*rand; - end -end - -params -y_vec=testFit.anon_fit_fun(x_vec,params{:}).*normrnd(1,0.04,size(x_vec)); -figure(1) -ax=gca; -plot(x_vec,y_vec,'x'); -axis([min(x_vec),max(x_vec),0.5*min(y_vec),1.5*max(y_vec)]); -hold on -testFit.Axes=ax; -testFit.enable_plot=1; -testFit.Data.x=x_vec; -testFit.Data.y=y_vec; -% testFit.genInitParams; -% testFit.init_params -% testFit.fitTrace; -% testFit.init_params \ No newline at end of file