# How to work with OOMMF files in Matlab

OOMMF can output both **scalar** and **vector** data. It’s easy enough to view this data using the built in programs in OOMMF, but what if you want to process or analyse your data further.

This post shows you how to **convert OOMMF vector files** into a format that you can import into matlab for further processing.

# Convert to a .mat file with OOMMFTools

The first step to working with OOMMF files in matlab is to** convert them into a ‘.mat’ file** that matlab can read.

To do this I like to use the command line version of OOMMFTools.

With this we can just run

$ omf2mat.py my_oommf_vector_file.omf

Although I’ve used a .omf file in this example, the same method works with any OOMMF vector file.

This will generate a .mat file containing this information:

GridSize; % cell size used in simulation (x,y,z) Iteration; % iteration number of this omf file MIFSource; % The mif file that generated this omf file OOMMFData; % Actual vector data (x_slice, y_slice, z_slice, (x,y,z)) SimTime; % simulation time of this omf file Stage; % simulation stage of this file

# The vector data

The vector information is stored in the .mat file as **‘OOMMFData’**. This is a 3-dimensional grid, representing the simulated geometry, with a (1×3) vector at each point representing the OOMMF vector values themselves.

See the OOMMFTools Readme for further **discussion of the .mat data**.

Once you have the data in this format, you can just use normal matlab array commands to access and manipulate the data.

Can i convert oommf vector files into .nb files (mathematica format)

As far as I know there isn’t a way at the moment to convert directly to nb files I’m afraid. You might be able to find a way of converting from the Matlab .mat file to Mathematica format though.

I have found additional package to the Wolfram Mathematica “oommfUtilities”, it can read any oommf file format

I think that is the easy way