%written by Joon Ho Kang, input from Teemu P. Miettinen.

Welcome! This MATLAB code is designed for analyzing mass accumulation rate (MAR) of mitotic cells. 
In this folder, you will find a sample data ('sampledata.mat'), so you can follow the instructions below to try it out. 

1. Run 'main.m' file
- While running analysis progress is displayed in MATLAB command window, occasionally asking if you want to proceed or stop. 
- 3 MATLAB figures should pop up while running the code

2. Once the analysis is done, there will be 'processed_sampledata.mat' file created. This contains processed results. To access them, double click 'param_short' in Workspace, and double click on the 1st index marked with '21X4 double'.

- 1st column: Time after metaphase-to-anaphase transition
- 2nd column: Fitting duration (min; center of the fitted line will be at the time shown in 1st column)
- 3rd column: Mean buoyant mass (pg) of the fitted segment
- 4th column: MAR (pg/h)



Notes: 

- Data format that can be analyzed using this code is
1st column: Time from metaphase-to-anaphase transition (h)
2nd column: Mass (pg)

- If you have .mat file to analyze you have to update the filename. Look at line 43 in 'main.m', where you can change to the filename of your .mat file. 

- This code is capable of running multiple data (cells). For example, your .mat file may have 'data1', 'data2', 'data3'... where each 'data' has single cell mass traces over time. 

- The processed results for multiple data (cells) will be all stored in one 'param_short' file under 'processed_sampledata.mat'. The param_short is an cell array, in which each cell carries the processed results for each data. (For example, processed results of data1 (cell #1) will be in param_short{1,1}, processed results of data2 (cell #2) will be in param_short{2,1} and etc.)

- Note that parameters that user can change will all be in 'main.m' folder. For example, the duration of each segment for linear fitting to obtain MAR ('breakup') is listed. 

- This code has been created and tested using MATLAB 2014b. Older versions may not properly run the code.


That's it. Enjoy!