Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9126009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:56:15+00:00 2026-06-17T06:56:15+00:00

I have a set of 3d data points for each of which the value

  • 0

I have a set of 3d data points for each of which the value V of a certain quantity is associated. The data are organized in ordered columns X Y Z V, where the spatial coordinates are distributed on a grid. I have 21 points in every direction, so that the lengths of the several columns is 21x21x21=9261. How can I transform the data into a meshgrid that can be used by isosurface in Octave/Matlab? My code is the following

a=load("data.txt");
X=reshape(a(:,1), 21,21,21);
Y=reshape(a(:,2), 21,21,21);
Z=reshape(a(:,3), 21,21,21);
V=reshape(a(:,2), 21,21,21);
fv=isosurface (X,Y,Z,V,0.9);
patch(fv)

But the result is not meaningful (i get two flat surfaces located at x=0.9 and 1.). The data can be downloaded here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:56:16+00:00Added an answer on June 17, 2026 at 6:56 am

    Here’s a way to create a proper meshgrid of your data:

    a = load('data.txt');
    [X, Y, Z] = meshgrid(unique(a(:, 1)), unique(a(:, 2)), unique(a(:, 3)));
    V = zeros(21, 21, 21);
    for i = 1:numel(V)
      idx = find(a(:, 1) == X(i) & a(:, 2) == Y(i) & a(:, 3) == Z(i));
      V(i) = a(idx, 4);
    end
    fv = isosurface (X,Y,Z,V,0.9);
    p = patch(fv);
    set(p,'FaceColor','red','EdgeColor','none');
    camlight;
    lighting gouraud;
    xlabel('x');
    ylabel('y');
    zlabel('z');
    

    enter image description here

    If you have much larger data and this is too slow, I can probably come up with a way of reshaping the original data to avoid the for-loop I’ve used above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data set with over 50,000 geocoded points (lat-long). Each point has
I have a set of data points in 3D space which apparently all fall
I have a set of X,Y data points (about 10k) that are easy to
I have a set of data, with columns x and y. This set contains
I have a 1 dimensional data set with some no data values which are
I have a piece of hardware for which I am getting 30 data points.
I have a data file which looks roughly like this # X Y Value
I have a huge data set and I have to compute for every point
I have set the data to div element and append it to another div
I have a set of data, and while the number of fields and tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.