# Biomod/2011/Caltech/DeoxyriboNucleicAwesome/Protocols/MATLAB

(Difference between revisions)
 Revision as of 23:53, 2 November 2011 (view source) (New page: ===Opening SPEX Data in MATLAB=== *Open up MATLAB and use File->Import Data *Navigate to the raw-text (.txt) data file and open it *The table on the right should show eight rows, where th...)← Previous diff Current revision (03:16, 3 November 2011) (view source) (2 intermediate revisions not shown.) Line 1: Line 1: + {{Template:DeoxyriboNucleicAwesomeHeader}} ===Opening SPEX Data in MATLAB=== ===Opening SPEX Data in MATLAB===

## Current revision

Friday, August 26, 2016

Home

Members

Project

Protocols

Progress

Discussion

References

### Opening SPEX Data in MATLAB

• Open up MATLAB and use File->Import Data
• Navigate to the raw-text (.txt) data file and open it
• The table on the right should show eight rows, where the odd ones are the times associated with the signal from the row under them. The top set is sample 1; the next is 2, the next is 3, the bottom set is sample 4. Press "next."
• Optionally right click on "data" and rename it to whatever you want. This isn't necessary unless you're afraid of your data getting overwritten eventually when you import another set.
• Click "finish."
• Your data should be visible in the "workspace" window with the name "data" or whatever you might have renamed it to. Right click on it -> "open selection" to view it.
• To plot a single sample's data, use this, where "data" is the name of your data variable:
`plot(data(1, :), data(2, :))`
• To plot all four samples' data on the same plot, use this:
`plot(data(1, :), data(2, :), data(3, :), data(4, :), data(5, :), data(6, :), data(7, :), data(8, :))`

### Normalizing SPEX Data in MATLAB

• Upon opening the data, use the following code, replacing "start" with the beginning of the experiment (for origami experiments, this will usually be immediately after the walker trigger is added), and replacing "finish" with the data point corresponding to the reaction reaching its completion level.
• Your data should be visible in the "workspace" window with the name "data" or whatever you might have renamed it to. Right click on it -> "open selection" to view it.
• The data is normalized such that the start of the reaction is at 1, and the completion level is at 0, by translating the completion level down, and then scaling the data.
`time1 = data(1, start:finish);`
`time2 = data(3, start:finish);`
`time3 = data(5, start:finish);`
`time4 = data(7, start:finish);`
`data1 = data(2, start:finish);`
`data2 = data(4, start:finish);`
`data3 = data(6, start:finish);`
`data4 = data(8, start:finish);`
`time1 = time1 - time1(1);`
`time2 = time2 - time2(1);`
`time3 = time3 - time3(1);`
`time4 = time4 - time4(1);`
`ndata1 = data1 - data1(finish - start + 1);`
`ndata2 = data2 - data2(finish - start + 1);`
`ndata3 = data3 - data3(finish - start + 1);`
`ndata4 = data4 - data2(finish - start + 1);`
`ndata1 = ndata1/ndata1(1);`
`ndata2 = ndata2/ndata2(1);`
`ndata3 = ndata3/ndata3(1);`
`ndata4 = ndata4/ndata4(1);`
`plot(time1, ndata1, time2, ndata2, time3, ndata3, time4, ndata4);`