Orientation of Table Headers in Science Report
This is how I would do it (essentially your first example):

&nbsp;



&nbsp;

My rationale for this is as follows:


It allows for including the average over your trials – which you have to compute and probably show anyway, and here is the best place to do it, as it can be compared with the data from the individual trials.
Your reader usually wants to quickly assess the following:


Do the individual trials for a given length agree with each other or with the average?
Do the average values agree with some information outside this table (theoretical expectation, figure, official solution)?


Both are not very comfortable in your second example: You either have to check groups of three that are not well separated visually or you have to go over the data in steps of three.
The structure of the table is more easy to grasp.
Each direction is only used for one purpose – in your second example, going vertical could mean increasing the length but also going from one trial to the next.
The least import information you have is the trial number; in fact it shouldn’t matter at all.
The suggested layout avoids it dominating the information and repeating it – if you show it at all.