Allen J. Hall

Materials Science & Engineering, Productivity, and Life

Part I: MATLAB Functions for Philips XPert XRD Files

I decided here and there to publish various MATLAB functions I’ve written for my own work. There’s just one caveat- each one of these is a serious work in progress. In fact, they may not progress much more than what is disclosed here since they get the job done for me.

But, I felt that this likely would help a few people who are trying to do the same type of thing, and I’d rather ease those who come after me, and give them a slight step ahead if possible.

For those of you with old version of the Philips XPert XRD software (specifically those who can’t output in XRDML files), I offer a crude import function for simple scans.

This function loadx00 loads “.x00″ files from the Philips XPert system. As you can see, this is a very crude function, it searches for the needed info from the file and grabs the next string as data etc. You can download this file as a text file here: loadx00.m, revision 8

function [Data, x] = loadx00(filename)

%%  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)
%%  If you happen to see some code that was copied from here or there
%%  you probably noticed that I copied some code form here and there.  ;) 
%%  (oh, btw, you get what you pay for- this isn't perfect!!)

%open file
fid = fopen(filename,'r');

%  First, we need to find the area in the header with the important info..
% so we search until we find our first important string:

for i = 1:40
C = textscan(fid,'%s',1,'delimiter',',');
if strcmp(C{1}, 'FirstAngle')
testme = 0;
break
end
end

% We found the important string, the following field will then be the number needed:
C = textscan(fid,'%f',1,'delimiter',',');
FirstAngle = C{1};

% Start from where we left off, and grab Scan Range
ScanRangeText = textscan(fid, 'ScanRange, %f',1);
ScanRange = ScanRangeText{1};

% Grab Step Width
StepWidthText = textscan(fid, 'StepWidth, %f',1);
StepWidth = StepWidthText{1};

% Make X-axis vector for plotting in the future
x = (FirstAngle:StepWidth:(FirstAngle + ScanRange));
x = x';

%skip some lines until the data:
C = textscan(fid, '%s', 5, 'delimiter',',');
DataText = textscan(fid, '%f');
Data = DataText{1};

fclose(fid);

Post a Comment

Your email is never shared. Required fields are marked *

*
*

A Quick Introduction...

I'm a graduate student (PhD Candidate) at the University of Illinois at Urbana-Champaign.

I've studied and researched in two fields of Materials Science and Engineering (Polymers and Semiconductors). My interests are as diverse as my musical tastes and I usually have my hand in some crazy project during my free time.

I'm available for consulting and have access to a world-renown materials research user-facility supported by the D.O.E. If you would like to know more, please contact me.

Popular Tags

Amazon Associate Link Apple Support AppStore Bug CIGS CIS CLI Conferences Cross Platform Data Mining data visualization dual-driver headphones failure Friend Geek Tool Great Scientists HAM Radio Hardware Tips How To Humanitarian IEM IM In-Ear Monitors iPod Touch LaTeX Linux Mac OsX Materials Science and Engineering Matlab Obituary Open Source problem Productivity reciprocal space return Silent Key Software Software Review Support This Blog Thesis Writing Tip UIUC VOIP Windows xrd

Support This Blog

You can support this blog by shopping on Amazon through my Affiliate Store.