#Load strucchange library
library(strucchange)

#Read input data which is tab seperated file.
data <- read.delim('MemFree.txt', header=F)

#Create an array based on num of columns (num of time series)
data_size <- dim(data)
print(data_size)
pari <- array(2)
#pari <- array(data_size[2])

for (i in seq(1, 2)){
        print(i)
	tt <- ts(data[i], start=1, end=3361)
	#tt <- ts(data[i], start=1, end=10081)
	#Find break points. NA - No breaks
	pari[i] <- breakpoints(tt ~ 1, h = 0.07142857)
}
print(pari)

#Save data in native format. This has to be formatted manually (easiest 
#option is to use vi/vim/emac text formatting/replacement options) to
#create a config file that can be used to build the time series library.
dput(pari, file="partitions.txt")
