Difference between revisions of "Biomod/2011/Caltech/DeoxyriboNucleicAwesome/Protocols/MATLAB"

From OpenWetWare
Jump to: navigation, search
Line 1: Line 1:
 +
{{Template:DeoxyriboNucleicAwesomeHeader}}
 +
 
===Opening SPEX Data in MATLAB===
 
===Opening SPEX Data in MATLAB===
 
*Open up MATLAB and use File->Import Data
 
*Open up MATLAB and use File->Import Data
Line 36: Line 38:
 
:<syntaxhighlight lang="matlab">ndata4 = ndata4/ndata4(1);</syntaxhighlight>
 
:<syntaxhighlight lang="matlab">ndata4 = ndata4/ndata4(1);</syntaxhighlight>
 
:<syntaxhighlight lang="matlab">plot(time1, ndata1, time2, ndata2, time3, ndata3, time4, ndata4);</syntaxhighlight>
 
:<syntaxhighlight lang="matlab">plot(time1, ndata1, time2, ndata2, time3, ndata3, time4, ndata4);</syntaxhighlight>
 +
{{Template:DeoxyriboNucleicAwesomeFooter}}
 +
 
{{Template:DeoxyriboNucleicAwesomeFooter}}
 
{{Template:DeoxyriboNucleicAwesomeFooter}}

Revision as of 23:16, 2 November 2011

DeoxyriboNucleicAwesomeHeader.jpg

Thursday, November 23, 2017

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:
<syntaxhighlight lang="matlab">plot(data(1, :), data(2, :))</syntaxhighlight>
  • To plot all four samples' data on the same plot, use this:
<syntaxhighlight lang="matlab">plot(data(1, :), data(2, :), data(3, :), data(4, :), data(5, :), data(6, :), data(7, :), data(8, :))</syntaxhighlight>

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.
<syntaxhighlight lang="matlab">time1 = data(1, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">time2 = data(3, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">time3 = data(5, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">time4 = data(7, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">data1 = data(2, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">data2 = data(4, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">data3 = data(6, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">data4 = data(8, start:finish);</syntaxhighlight>
<syntaxhighlight lang="matlab">time1 = time1 - time1(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">time2 = time2 - time2(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">time3 = time3 - time3(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">time4 = time4 - time4(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata1 = data1 - data1(finish - start + 1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata2 = data2 - data2(finish - start + 1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata3 = data3 - data3(finish - start + 1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata4 = data4 - data2(finish - start + 1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata1 = ndata1/ndata1(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata2 = ndata2/ndata2(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata3 = ndata3/ndata3(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">ndata4 = ndata4/ndata4(1);</syntaxhighlight>
<syntaxhighlight lang="matlab">plot(time1, ndata1, time2, ndata2, time3, ndata3, time4, ndata4);</syntaxhighlight>


</td> </tr> </table>