Hi all,
I have data of lots of single particle trajectories that run for different lengths of time which I'd like to be able to plot them onto a 2D graph, with all the trajectory start positions normalised to 0,0 origin, so the plot looks a bit like the following:
My data is in an excel sheet with PARTICLE_ID, Time, X and Y co-ordinate (see attached testdata.xlsx file for example of 5 particle trajectories)
After importing the data as a matrix, I presume I must use mat2cell to convert the matrix to smaller cell arrays, with each cell array representing the data different particle trajectories? Currently I have the following code:
C = mat2cell(testdata, [59 56 240 56 10], [4])C = 5×1 cell array { 59×4 double} % trajectory 1
{ 56×4 double} % trajectory 2
{240×4 double} % trajectory 3
{ 56×4 double} % trajectory 4
{ 10×4 double} % trajectory 5
However, if I have a file with >100s of trajectories, how would I code this so I don't have to manually specify the cell array sizes for each trajectory?
Then the next question is how do I normalise all the particle trajectory coordinates so that they begin at the origin 0,0?
I'd greatly appreciate any help you can offer.
Thank you in advance!
Amadeus
Best Answer