MATLAB file exchange utility

Category: Data Import/Export
Description: Instructions To use this utility, copy the file "DM-MATLAB file exchange.gtk" into the "plugins" folder (C:Program FilesGatanDigitalMicrographPlugIns) and restart DigitalMicrograph. It should show up as a submenu group "DM-MATLAB file exchange" under the "Custom" menu. Descriptions Exchange data between DigitalMicrograph and MATLAB (1) Exporting: Save a front image in DM to a MATLAB (*.mat) file as a "miMATRIX" data element. Currently it supports image with dimensions up to 4. Image with data type of binary, RGB or complex is not supported. (2) Importing: When opening a MATLAB (*.mat) file for importing, a selection dialog will be presented first. It will list all eligible "miMATRIX" data elements (numerical matrix with dimensions known issues: A normal (2D) image in DM will be "transposed" in MATLAB but it will be restored to the proper form when reading back into DM. A 3D image stack in DM should remain as a "stack" in MATLAB except the aforementioned "transpose" in first two dimensions. Four dimensional images (e.g. data from STEM Diffraction Imaging) can also be exchanged between DM and MATLAB. However, the dimension order of a 4D array in MATLAB has not been verified and mostly likely it is different than that in DM. Last, when encounter a "structural matrix" elements with dimensions greater than 1x1, a warning message will be displayed. Just ignore it.
Comments: Second script: string packageName = "DM-MATLAB file exchange"; string menu = "Custom", submenu = "DM-MATLAB file exchange"; number true = 1, false = 0; number pkgLevel = 3 // number IsLibrary; string script, cmd, strScriptFile, path; // check if current directory is correct one path = GetApplicationDirectory( 2, false ); while( !DoesFileExist(path + "MATLab file handler library.s") ) { if( !GetDirectoryDialog( null, "Cannot find script files, please locate the containing folder:", path, path ) ) exit(false); }; // add scripts to package IsLibrary = true; strScriptFile = path + "MATLab file handler library.s"; cmd = "MATLab file handler library"; strScriptFile.AddScriptFileToPackage( packageName, pkgLevel, cmd, menu, submenu, IsLibrary); IsLibrary = false; script = "alloc(Import_MATLAB_file).DoAction()"; cmd = "Import MATLAB (*.mat) file ..."; script.AddScriptToPackage( packageName, pkgLevel, cmd, menu, submenu, IsLibrary); script = "alloc(Export_as_MATLAB_file).DoAction()"; cmd = "Export as MATLAB (*.mat) file ..."; script.AddScriptToPackage( packageName, pkgLevel, cmd, menu, submenu, IsLibrary); // result( "Scirpt package [" + packageName + "] built sucessfullyn" );
Script version: 1.0
DM/GMS version: 1.7 - 1.8
Script written as a function: No
Source: Show code
Download Source Code: Download
Download Zip File: Download