Importing surfaces from Matlab to Blender

Matlab is a programming environment that’s well-used in scientific computation. In particular, it allows you to create surfaces from an array of data in (x,y,z) format. These surfaces can be colored according to a color matrix. For example, here is a surface that’s easily created in Matlab using the code


[x,y,z] = peaks;
surf(x,y,z,z); % surface height = z and color matrix = z


I’d like to be able to import this surface into Blender, along with its texture data. What is the easiest way to do that?

A program which does half the magic is the ‘saveobjmesh’ code here, which allows one to export the Matlab surface as an obj file, which can then be imported in Blender. Note that the uv coordinates of the faces are also exported in the obj file.

So the other half of the story is…how do you color the surface? A program like POV-Ray has mesh2 objects, which are capable of reading in texture lists to apply to each of the faces. Can you do the same with Blender?

Bump!

Surely there must be a way for Blender to read in uv texture data (in RGB or what-have-you) from a data file or matrix…?