# Plotting a giant surface exceeding array limitations

5 views (last 30 days)
Robert Scott on 3 Dec 2023
Commented: Robert Scott on 4 Dec 2023
Hi all
I have a need to plot a large surface.
Im trying to create a multi dimensional array.
Picture the following.
A typical X and Y plot that is a vector that has 40,000 data points. If you plot that you get a simple traditional XY graph.
Now, i have say 100 of the X and Y vectors and want to plot them all as a surface.
I tried something like this to build the array first. According to the matlab documentation the 3rd variable is like a page variable. Which is exactly what i need.
So to start i just tried
test = zeros(40,000,40,000,100)
And i got an error saying that my array will take 775 gig of space lol
So how does one go about doing this?
Thanks
Robert Scott on 3 Dec 2023
I looked into that but there are very poor examples for tall arrays mostly using data that already exists in some file.

Matt J on 3 Dec 2023
Edited: Matt J on 3 Dec 2023
First of all, you should consider downsampling from 40000 points to perhaps 400. Having very dense data beyond a certain point will not help you better visualize the surface.
Aside from that, though, your surface will have 40000*100 points, so a trisurf plot would only require you to form 40000x100 arrays.
[Xsurf,Ysurf,Zsurf]=deal(zeros(4e4,100)); %pre-allocate
Matt J on 4 Dec 2023
How can i get this to work with just a simple meshgrid.
I don't think you can, because in your original problem description, your X,Y data is scattered, not gridded. Ifthat's no longer the case, it would seem that you have a whole new problem and you should accordingly post a whole new question.
Robert Scott on 4 Dec 2023
Thanks, Matt
Well, i have no idea how it works but it works.
I basically just took 3 giant vectors X,Y and T and put them in the surf command and it worked.
This turned out to be a total waste of a day sadly. My misinterprestation of the data set really screwed me up and caused me to write many nonsensical scripts.
In the end, your original solution or my cell array solution would work for something like this.
I thank you for your persistance in helping me esepcailly on a sunday.

### Categories

Find more on Surface and Mesh Plots in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!