def buildX(traj_file, t, X):
    """
    Builds the node attribute matrix for a given time step.

    Inputs: 
    traj_file : string indicating the location of the ground truth trajectory data
    t : scalar indicating current time step
    X : empty node attribute matrix in shape [n_nodes, n_features]

    Outputs: 
    X : node attribute matrix with values added from traj_file in shape [n_nodes, n_features]
    """
    # read through the file to find the current time step from "t = 100" etc.
    with open(traj_file) as f:
        lines = f.readlines()

        i = -1

        # find the line that contains the time step information
        for line in lines:
            i += 1
            if line[0:4] == "t = " and int(line[4:]) == t: 
                # print("found time {0} in trajectory data".format(t))

                count = 0 
                for line in lines[i:]:
                    # print("count", count)
                    # extract these lines and make a graph
                    if count < 3:
                        count += 1
                        continue

                    if ((count >= 3) and (count < (X.shape[0] + 3))):

                        # X(i,1:-1) = all data in the current row of .oxdna file
                        j = 1 
                        my_str = ""
                        for k in range(len(line)):
                            if line[k] != " " and line[k] != "\n":
                                my_str += line[k]
                            if line[k] == " " or line[k] == "\n":
                                X[(count-3),j] = float(my_str)
                                j += 1
                                my_str = ""
                        
                        count += 1
                    
                    else:
                        break
    
    return X