MATLAB Passing 3D Array from Fortran to Matlab

  • Thread starter Thread starter Triscas
  • Start date Start date
  • Tags Tags
    3d Array Fortran
Click For Summary
The discussion centers on transferring a 3D array from Fortran to MATLAB, specifically a matrix with dimensions (16, 221, 900). It highlights the importance of understanding Fortran's column-major order for proper data interpretation. Participants suggest starting with a smaller, manageable 3D matrix, such as a 2x3x4 array, to practice reading and reshaping data in MATLAB. The conversation encourages experimentation with different formats, including reading the array as a single vector before reshaping it in MATLAB. Overall, the focus is on practical steps to facilitate the transition of data between the two programming environments.
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 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
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 20 ·
Replies
20
Views
4K