MATLAB Answers

How to plot a 3D grid in MATLAB which has been exported from Petrel with the MATLAB-Petrel plugin?

12 views (last 30 days)
Ferry Nieuwland
Ferry Nieuwland on 16 Oct 2019
Answered: Pranjal Kaura on 1 Sep 2021
Hello Community,
I have exported a grid from Petrel with the MATLAB-Petrel plugin. I can read this grid with no problem into MATLAB with the load command (A=load("TEST.mat"). I have a problem plotting this grid in MATLAB. Below what I have been trying and the error message I get. I have attached the grid to this posting. I hope you can help me here.
>> meshgrid(A.Node.X,A.Node.Y,A.Node.Z)
Error using repmat
Requested 38704x38704x38704 (431974.1GB) array exceeds maximum array size preference.
Creation of arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive. See array size limit or preference panel for more information.
Error in meshgrid (line 77)
xx = repmat(xx, ny, 1, nz);
Do you have any suggestion what is going wrong?
I tried to change the maximum array size to 100000, but was not allowed to go over 10000.
Kind Regards,
Ferry

Answers (1)

Pranjal Kaura
Pranjal Kaura on 1 Sep 2021
Hey,
It looks like the creation of the 3-D meshgrid for your input vectors ('A.Node.X', 'A.Node.Y', 'A.Node.Z') requires very large amounts of memory allocation, which exceeds maximum array size preference. To know more about the variable size preferences, please refer https://www.mathworks.com/help/matlab/matlab_env/set-workspace-and-variable-preferences.html.
A workaround could be to to generate the required matrices in batches and concatenating them in an external .mat file. You can read more about it here. However, looking at the error, and the input vector dimensions, your machine would still need 400+ TB of memory and the computation would take a lot of time, making the approach non-viable in most scenarios.
You could try reducing the input vector size, or replacing meshgrid with another function.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by