I have created a three dimensional array "data" in matlab by using the following commands :

save data;

As you can see, most of elements in "data" have the value 100, but there are two zones located at two corners with value 20 and 80 respectively. Then I created a graph to show these two zones. Using the "isosurface" function in matlab, I get the picture below enter image description here

Now I want to import the "data" into mma, and plot a similar graph in mma. I tried the following commands in mma but got some errors :enter image description here

what's the mistake ? how should i do?
thanks for reviewing the navie quetions : )

  • 1
    $\begingroup$ Have you seen this: mathematica.stackexchange.com/a/24478/5 $\endgroup$
    – rm -rf
    Commented Oct 27, 2015 at 8:50
  • $\begingroup$ Please show precisely what you tried so far. I don't see any problems when importing a mat file generated this way. $\endgroup$
    – Szabolcs
    Commented Oct 27, 2015 at 10:43
  • $\begingroup$ (Just use Import) $\endgroup$
    – Szabolcs
    Commented Oct 27, 2015 at 10:51
  • $\begingroup$ It's a good idea to look at the structure of the expression that Import returns. What I get is a list containing a path (string) and a 3D array. I need to take the second element of the list to get the 3D array. From the error message in your post it looks like you have a list containing a single 3D array. Take the first element of the list. $\endgroup$
    – Szabolcs
    Commented Oct 28, 2015 at 10:56

1 Answer 1


Your "data" has most values 100 with some 80s and some 20s, yet your imported array from data.mat is almost all 1's. Once you locate the correct data file, you can check that


has the wrong format for 3D plotting. You can fix this with Flatten, and then:

ListPlot3D[Flatten[a, 1]]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.