function TransM=TransitionMatrixFromTraj(conIn, samples, stepsize, countmode)		


javaclasspath({'/home/cocktail/luedge/mbtoolkit/MolTools/lib'...
   '/home/cocktail/luedge/mbtoolkit/MolTools/netbeans_project/build/classes/'...
   '/home/cocktail/meerbach/Netbeans_projects/Metamacs/dist/lib/colt.jar'...
   '/home/cocktail/meerbach/javawerkstatt/Metamacs/lib/concurrent.jar'...
   '/home/cocktail/meerbach/Netbeans_projects/Metamacs/build/classes/'});


import biocomp.moltools.*;
import cern.colt.matrix.impl.*;
import java.io.*;
import biocomp.metamacs.*;
import biocomp.moltools.discretization.*;
import biocomp.moltools.util.*;

a=0:1:samples;


for i=1:samples
DistOut(find(conIn<(i*(1/samples))&conIn>(i-1)*(1/samples)),1)=a(i);
end

file='temp.dat';
    b=0;
    save file b   
    fid = fopen(file, 'w');
    for i=1:size(DistOut,1)
    fprintf(fid, '%d\n',DistOut(i));
    end

    
DisTraj = DiscreteTrajectoryFactory.loadDiscreteTrajectory(file);
TransMa = TransitionMatrix(DisTraj, countmode, stepsize, 0);
TransM = TransMa.getTransitionMatrix();