I'm pretty sure you're going to want to loop through this file line by line
and use some regular expressions to pull out the lines with the relevant
information. The regex r"^\s*(\d+)\s+(\d+\.\d*)\s+(\d+)\s+(\d+\.\d*)\s*$"
should find those particular lines. I'm not sure if the 79 and 105 bits are
going to be the same every time or not, if so, you could leave those in
there like so: r"^\s*79\s+(\d+\.\d*)\s+105\s+(\d+\.\d*)\s*$".
open("results.txt") do file
for line in eachline(file)
m = match(r"^\s*79\s+(\d+\.\d*)\s+105\s+(\d+\.\d*)\s*$", line)
m == nothing && continue
a = parse(Float64, m.captures[1])
b = parse(Float64, m.captures[2])
# do something with a and b
end
end
On Mon, Jul 20, 2015 at 11:20 AM, Mike <[email protected]> wrote:
> Hi again
>
> Sorry for posting on multiple sites. I finally did it :
> file=open("results.txt")
> l=readlines(file)
> y,x=zeros(505),zeros(505)
> c=1
> for i=1:length(l)
> l[i]=strip(l[i])
> if(contains(l[i],"total transient time")==true)
> k1=split(l[i])
> x[c]=float(k1[5])
> c+=1
> end
> if(contains(l[i],"79")==true&&contains(l[i],"105")==true)
> k=split(l[i])
> y[c]=float(k[2])
> end
> end
> I know the number of increments (505) so i could just create array before
> loop, but i want code to be little bit more flexible, how to declare array
> (x,y in this case) that size is related to c which is unknown before code
> execution?
>
> Regards
> Mike
>