Passing 3D Array from Fortran to Matlab

  • Context: MATLAB 
  • Thread starter Thread starter Triscas
  • Start date Start date
  • Tags Tags
    3d Array Fortran
Click For Summary

Discussion Overview

The discussion revolves around the challenge of passing a 3D array from Fortran to Matlab, specifically focusing on understanding how to read and interpret the array values in Matlab given Fortran's column-major order storage.

Discussion Character

  • Exploratory, Homework-related

Main Points Raised

  • One participant expresses uncertainty about how to read a 3D array in Matlab and seeks guidance on transferring a Fortran array to Matlab.
  • Another participant questions the clarity of the initial inquiry, suggesting that the original poster may need to clarify whether their confusion relates to Fortran or Matlab.
  • A suggestion is made to start with a smaller, recognizable 3D matrix (like a 3x3x3 or 2x3x4 array) to help understand the reading process in Matlab.
  • Participants encourage experimentation with different formats for reading the array into Matlab, including reshaping a single vector.
  • One participant acknowledges the practical idea of using a smaller matrix for testing purposes.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best approach to read the 3D array into Matlab, and multiple suggestions and viewpoints are presented without resolution.

Contextual Notes

The discussion does not address specific limitations or assumptions regarding the data types or structures involved in the transfer process.

Who May Find This Useful

Individuals working with data transfer between Fortran and Matlab, particularly those dealing with multidimensional arrays.

Triscas
Messages
9
Reaction score
0
Hello!

I'm working in a programm which has a 3D array with a DIMENSION(16,221,900). When I use the debugger option and I print out the value of the matrix I don't know how to read the info.

I already know Fortran uses column-major order, storing the columns in sequence.

My doubt is: How could I pass this temporary value of the array to Matlab?
 
Physics news on Phys.org
I don't exactly know what you are asking...does it have anything to do with fortran or not? or do you just don't know how to read a 3 dimensional matrix into matlab?

Not that I can help because I don't use matlab, but I will give the same advice I always give: "baby steps...baby steps".

So, first put together a small 3-D matrix you can memorize and recognize, like a 3x3x3 matrix with the numbers 1-9 in the first plane, and so on...

...can you read this into matlab?
in which format?
can you read it as a single vector and then reshape it inside?

Get creative, try stuff out, alternatives, etc,
 
gsal said:
So, first put together a small 3-D matrix you can memorize and recognize, like a 3x3x3 matrix with the numbers 1-9 in the first plane, and so on...

Or better, a 2x3x4 array, so you will know if you get the different dimensions (2, 3 and 4) in the wrong order for some reason.
 
Oh, that's a good, practical idea.

Just googled...found this.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 4 ·
Replies
4
Views
7K