File Exchange

image thumbnail

CreateGuid MEX

version 1.0 (2.42 KB) by

MEX to create a Globally Unique Identifier GUID



View License

A MEX file to calculate a GUID. A Globally Unique Identifier or GUID is a pseudo-random number used in software applications. Each generated GUID is "statistically guaranteed" to be unique. This is based on the simple principle that the total number of unique keys ( or ) is so large that the possibility of the same number being generated twice is virtually zero.

To compile:

 mex CreateGuid.c rpcrt4.lib

I also tried to implement with .net but I found it to be much slower when needing a lot of GUIDs.

Comments and Ratings (3)


Tom (view profile)

Thanks Joseph ... your solution worked for me (after casting to char)


Joseph Burgel

Had some issues compiling this in Windows 7 an ML 2010a. After a little digging, I found:
x = java.util.UUID.randomUUID()
which worked fine for my purpose. Thanks.

Steve Hoelzer

Worked as advertised and really useful. I compiled it with MS Visual C++ .NET 2003. Could use a readme file or a few more comments in the code.

MATLAB Release
MATLAB 7.2 (R2006a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video