Passing 3D Array from Fortran to Matlab

In summary, the conversation discusses how to read a 3D array with dimensions of 16, 221, and 900 into Matlab. The speaker suggests breaking it down into smaller, easier to understand matrices and experimenting with different formats and alternatives. They also suggest checking online resources for help.
  • #1
9
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?
 
Technology news on Phys.org
  • #2
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,
 
  • #3
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.
 
  • #4
Oh, that's a good, practical idea.

Just googled...found this.
 

1. How do I pass a 3D array from Fortran to Matlab?

To pass a 3D array from Fortran to Matlab, you can use the "mex" interface to create a shared library that can be called by both languages. This allows for efficient data transfer between the two languages.

2. Can I pass a 3D array from Fortran to Matlab without using the "mex" interface?

Yes, it is possible to pass a 3D array from Fortran to Matlab without using the "mex" interface. However, this may not be as efficient and may require more code to be written.

3. What is the best way to handle passing large 3D arrays from Fortran to Matlab?

The best way to handle passing large 3D arrays from Fortran to Matlab is to use the "mex" interface. This allows for efficient data transfer and can handle large arrays without causing memory issues.

4. Are there any limitations to passing 3D arrays from Fortran to Matlab?

There are some limitations to passing 3D arrays from Fortran to Matlab, such as the size and type of the array. It is important to make sure that the array is compatible with both languages to avoid any errors.

5. Can I pass a 3D array from Fortran to Matlab in real-time?

Yes, it is possible to pass a 3D array from Fortran to Matlab in real-time using the "mex" interface. This allows for efficient and fast data transfer, making it suitable for real-time applications.

Suggested for: Passing 3D Array from Fortran to Matlab

Replies
1
Views
812
Replies
4
Views
4K
2
Replies
60
Views
2K
Replies
20
Views
3K
Replies
32
Views
2K
Replies
4
Views
939
Back
Top