A series of MATLAB functions will follow. Some of these “.m” files call each other, so ensure you have all of them before you start.
The purpose of this file is to load in all the .x00 files in a directory of Omega-Omega-2-Theta slices for reciprocal space mapping of a sample. Please note that as of this writing, the data has not yet been converted to Q-space.
The first function loads data into your workspace for a directory of .x00 files that have a common base filename. The user needs to supply the first index number and last index number for loading the files. The program then attempts to load “filenameIndex.x00″ in a linear fashion for all .x00 files of that filename indexed in the cd’d directory. [Change directory to the working directory needed before starting this function.]
You can download this file as a text file here: dirload.m, revision 8
function [mydata, myx] = dirload(filename,startnum,stopnum); %% version written on Wednesday; October 1, 2008 %% %% This function was written by Allen J. Hall %% allen@allenjhall.com %% http://www.allenjhall.com/content/ %% Free to use in part or full. %% However, the following must remain free and not be paid for. %% (creative commons copyright may apply) %% %% (oh, btw, you get what you pay for- this isn't perfect!!) % Let's preload a single dataset to see the length that we require. [DataTemp, XTemp] = loadx00(sprintf('%s%i.x00',filename,startnum)); % Total number of scans NumScans = stopnum - startnum; % what's the size of the first one?? %fprintf(1, 'Data size for DataTemp for Scan #%i is:', startnum); %DataTemp datasize = size(DataTemp); %fprintf(1, 'Data size for DataTemp for Scan #%i is:', startnum); xsize = size(XTemp); fprintf(1,'Loading Data From Directory...\n'); datacounter = 0; for i = startnum:stopnum [DataTemp, XTemp] = loadx00(sprintf('%s%i.x00',filename,i)); %fprintf(1, 'After Loading Scan #%i, DataTemp size is:', i); size(DataTemp); datacounter = datacounter+1; datatemp = DataTemp; mydata(:,datacounter) = datatemp; myx(:,datacounter) = XTemp; end