Using Digitized Graph Data in Matlab
|
Graphs digitized with Dagra can be loaded into Matlab in three ways. The easiest is with the function for Matlab. This function loads Dagra documents into a Matlab structure. Digitized data can also be copied onto the clipboard ( in Dagra) and pasted into Matlab's command line window or exported into a text file ( in Dagra) and imported using Matlab's dlmread function. On this page: Using the LoadDagra.m Matlab functionSetupLoadDagra.m must be on Matlab's search path before it can be used. The function is installed in the Dagra application directory in the folder Components\Matlab\. If Dagra was installed in the default location, then the Matlab command to include it in the search path is: >> addpath('c:\Program Files\Blue Leaf Software\Dagra\Components\Matlab'); Load the dataLoadDagra.m takes a single argument, the path to the Dagra document to load. Only the filename is needed if the file is in the current directory. It returns a structure containing fields for each series in the Dagra document:
>> data = LoadDagra('Bromocresol green.dag') Spaces in the series name are replaced by underscore characters to form valid Matlab fields. The Series StructureEach series structure contains two fields: x and y. Each is a vector containing the exported data. These vectors will always be the same length.
>> data.Acid Note: if you are using an expired trial version of Dagra, the exported data contains random noise. Purchase a Dagra license to recover the original high-precision data. Plotting the DataThis Matlab code creates a plot showing the graphical source image on the left and data digitized with Dagra on the right:
>> figure(1);
The spectrum of Bromocresol green from Wikipedia (left) and the digitized data plotted in Matlab (right). Interpolating the DataDagra exports sufficient data to accurately reconstruct the curves. So intermediate values can be obtained with linear interpolation using Matlab's interp1 function. To estimate the absorbance of the acid form of Bromocresol green at 450, 515 and 570 nm, for example:
>> interp1(data.Acid.x, data.Acid.y, [450 515 550]) Download LoadDagra.m for MatlabLoadDagra.m is installed by the Dagra setup file. It can be found in the Components\Matalb folder of the installation directory (normally c:\Program Files\Blue Leaf Software\Dagra). A trial version of Dagra is available here. You can also download LoadDagra.m here |