Code covered by the BSD License  

Highlights from
Seis_Pick

image thumbnail

Seis_Pick

by

 

06 Feb 2012 (Updated )

Seis_Pick provides an interactive picking environment for processing seismic data.

[nums,inums]=get_numbers(stringarg)
function [nums,inums]=get_numbers(stringarg)
% function [nums,inums]=get_numbers(stringarg)
%
% e.g., [nums,inums]=get_numbers('nums')
%
% Returns colon-separated vector from the input string
% 'inums' is 1 if argument can be found, 0 if it cannot
%
% J.P. Verdon, UoB, 2011
%

% Find numbers
inums=0;
keywd='numbers';
for i=length(keywd)+1:length(stringarg)
    if strcmp(stringarg(i),'=') == 1
        wd=[stringarg(i-length(keywd):i-1)];
        if strcmp(wd,keywd) == 1
            inums=1;
            for j=1:10
                tl=stringarg(i+j);
                if strcmp(tl,':') ~= 1
                    numstr(j)=tl;
                else
                    break
                end
            end
            for k=j+1:10
                if i+k > length(stringarg)
                    break
                end
                tl=stringarg(i+k);
                if strcmp(tl,' ') ~= 1
                    numstr2(k)=tl;
                else
                    break
                end
            end
        end
    end
end
num1=str2num(numstr);
num2=str2num(numstr2);
nums=num1:num2;

Contact us