Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
missing z axis

Subject: missing z axis

From: nman2084

Date: 30 May, 2011 20:40:20

Message: 1 of 6

I doing tetramesh plot after delaunay3, there are no errors but the z axis is not showing up, the data is x, y, z values. I can only see the X and Y axis but no z axis.

Subject: missing z axis

From: ImageAnalyst

Date: 30 May, 2011 21:31:28

Message: 2 of 6

On May 30, 4:40 pm, "nman2084 " <ng2...@yahoo.com> wrote:
> I doing tetramesh plot after delaunay3, there are no errors but the z axis is not showing up, the data is x, y, z values. I can only see the X and Y axis but no z axis.

----------------------------------------------------
I see:
- No sample data
- No sample source code
- No figure, diagram, picture posted anywhere
- Nothing that we can work with or visualize at all
- No question asked at all

and the Crystal Ball Toolbox is still yet to be released.

What are we supposed to do with your posting?

Subject: missing z axis

From: nman2084

Date: 30 May, 2011 22:10:04

Message: 3 of 6

Data is x, y, z values in txt file.

num_open = input('Enter the number of files to process ');
m = num_open;

% create cells for variables
dat = cell(1,m);
x = cell(1,m);
y = cell(1,m);
z = cell(1,m);
verts = cell(1,m);
faces = cell(1,m);
vol_litr= cell(1,m);
vol_gal = cell(1,m);
K = cell(1,m);
v = cell(1,m);
fn = cell(1,m);
pn = cell(1,m);
file = cell(1,m);

fout= ['rockVolume.txt'];
fid2 = fopen(fout,'a');

hold on;

for i = 1:m
    
    [fn{i},pn{i}] = uigetfile('*.txt', 'Open the txt file to be read');
    file{i}=fullfile(pn{i},fn{i});
    dat{i} = load(file{i});
    x{i} = dat{i}(:,1);
    y{i} = dat{i}(:,2);
    z{i} = dat{i}(:,3);
    
    verts{i} = [x{i}(:), y{i}(:), z{i}(:)];
    faces{i} = delaunay3(x{i}, y{i}, z{i});
    
    tetramesh(faces{i}, verts{i});
    shading('faceted');
    
    

    [K{i}, v{i}] = convhulln(verts{i}) ;
    
    vol_litr{i} = v{i}*1000; % in liters
    vol_gal{i} = vol_litr{i}*0.264172052; % in gallons
    
    fprintf(fid2, ' %5f ', vol_litr{i});
    fprintf(fid2, ' %5f \n', vol_gal{i});
    
end

xlabel('X (in meters)'); ylabel('Y (in meters)'); zlabel('Z (in meters)');

fclose('all');

Subject: missing z axis

From: ImageAnalyst

Date: 30 May, 2011 22:18:53

Message: 4 of 6

Come on, make it easy for us. You gotta work with us here. Upload
your data file to your favorite file sharing web site (Google it), and
then come back here and tell us the URL and then state your question.

Subject: missing z axis

From: nman2084

Date: 30 May, 2011 22:54:04

Message: 5 of 6

Hi, sorry here is some 2000 entries of data file, I really don't want to share the data file any where else.

1.53 22.60 -1.65
1.52 22.59 -1.61
1.53 22.59 -1.62
1.53 22.59 -1.63
1.53 22.59 -1.64
1.54 22.58 -1.64
1.54 22.58 -1.65
1.55 22.57 -1.66
1.57 22.55 -1.67
1.58 22.55 -1.67
1.57 22.56 -1.69
1.56 22.57 -1.70
1.55 22.58 -1.71
1.52 22.58 -1.60
1.53 22.57 -1.61
1.53 22.57 -1.62
1.54 22.57 -1.63
1.54 22.56 -1.63
1.57 22.55 -1.64
1.57 22.54 -1.65
1.58 22.54 -1.66
1.58 22.54 -1.67
1.58 22.54 -1.67
1.58 22.54 -1.68
1.58 22.54 -1.69
1.56 22.55 -1.70
1.55 22.57 -1.72
1.53 22.58 -1.73
1.51 22.57 -1.58
1.53 22.56 -1.59
1.54 22.55 -1.60
1.54 22.55 -1.61
1.55 22.54 -1.61
1.57 22.53 -1.62
1.57 22.52 -1.63
1.58 22.52 -1.64
1.58 22.52 -1.65
1.58 22.52 -1.66
1.58 22.52 -1.66
1.58 22.52 -1.67
1.58 22.52 -1.68
1.58 22.53 -1.69
1.57 22.53 -1.70
1.56 22.54 -1.71
1.55 22.55 -1.73
1.53 22.57 -1.74
1.51 22.56 -1.58
1.53 22.54 -1.59
1.54 22.54 -1.59
1.55 22.53 -1.60
1.56 22.53 -1.61
1.57 22.51 -1.62
1.58 22.51 -1.63
1.58 22.51 -1.63
1.58 22.51 -1.64
1.58 22.51 -1.65
1.58 22.51 -1.66
1.59 22.51 -1.67
1.58 22.51 -1.68
1.58 22.51 -1.69
1.58 22.52 -1.70
1.57 22.53 -1.71
1.55 22.54 -1.72
1.54 22.55 -1.73
1.53 22.56 -1.74
1.50 22.58 -1.76
1.48 22.60 -1.77
1.50 22.56 -1.57
1.52 22.55 -1.58
1.53 22.53 -1.58
1.54 22.52 -1.59
1.55 22.52 -1.60
1.56 22.51 -1.61
1.57 22.50 -1.61
1.58 22.50 -1.62
1.58 22.50 -1.63
1.58 22.50 -1.64
1.58 22.50 -1.65
1.58 22.50 -1.66
1.59 22.50 -1.67
1.59 22.50 -1.68
1.59 22.50 -1.69
1.58 22.50 -1.70
1.57 22.52 -1.71
1.56 22.52 -1.72
1.54 22.54 -1.73
1.54 22.54 -1.74
1.53 22.55 -1.75
1.49 22.58 -1.76
1.49 22.55 -1.56
1.51 22.54 -1.57
1.52 22.53 -1.58
1.53 22.52 -1.58
1.55 22.51 -1.59
1.55 22.50 -1.60
1.57 22.49 -1.61
1.57 22.49 -1.61
1.58 22.49 -1.62
1.58 22.48 -1.63
1.59 22.48 -1.64
1.59 22.48 -1.65
1.59 22.48 -1.66
1.59 22.48 -1.67
1.59 22.48 -1.68
1.59 22.48 -1.69
1.59 22.49 -1.70
1.58 22.50 -1.71
1.56 22.51 -1.72
1.55 22.52 -1.73
1.54 22.52 -1.74
1.54 22.53 -1.75
1.52 22.54 -1.76
1.52 22.55 -1.77
1.48 22.55 -1.56
1.51 22.53 -1.57
1.52 22.52 -1.57
1.53 22.51 -1.58
1.54 22.50 -1.59
1.55 22.49 -1.60
1.57 22.48 -1.60
1.57 22.48 -1.61
1.58 22.48 -1.62
1.58 22.47 -1.63
1.59 22.47 -1.64
1.59 22.47 -1.65
1.59 22.47 -1.66
1.59 22.47 -1.66
1.59 22.47 -1.67
1.59 22.47 -1.68
1.59 22.47 -1.69
1.59 22.48 -1.70
1.58 22.49 -1.71
1.57 22.49 -1.72
1.55 22.50 -1.73
1.54 22.52 -1.75
1.53 22.52 -1.76
1.50 22.55 -1.77
1.49 22.53 -1.56
1.51 22.52 -1.57
1.52 22.51 -1.58
1.53 22.50 -1.58
1.54 22.49 -1.59
1.55 22.48 -1.60
1.57 22.47 -1.61
1.57 22.47 -1.61
1.58 22.47 -1.62
1.58 22.46 -1.63
1.59 22.46 -1.64
1.59 22.46 -1.65
1.59 22.46 -1.66
1.59 22.46 -1.67
1.59 22.46 -1.67
1.59 22.46 -1.68
1.59 22.46 -1.69
1.59 22.46 -1.70
1.58 22.47 -1.71
1.57 22.48 -1.72
1.56 22.49 -1.74
1.55 22.50 -1.75
1.53 22.51 -1.76
1.50 22.54 -1.77
1.46 22.54 -1.56
1.50 22.51 -1.56
1.50 22.51 -1.57
1.52 22.50 -1.58
1.52 22.49 -1.58
1.54 22.48 -1.59
1.55 22.47 -1.60
1.56 22.46 -1.61
1.57 22.46 -1.61
1.58 22.45 -1.62
1.58 22.45 -1.63
1.58 22.45 -1.64
1.59 22.45 -1.65
1.59 22.45 -1.66
1.59 22.44 -1.66
1.59 22.44 -1.67
1.59 22.44 -1.68
1.59 22.45 -1.69
1.59 22.45 -1.70
1.59 22.45 -1.71
1.58 22.46 -1.72
1.57 22.47 -1.73
1.56 22.48 -1.74
1.53 22.50 -1.76
1.50 22.53 -1.77
1.44 22.54 -1.55
1.49 22.51 -1.56
1.50 22.50 -1.57
1.51 22.49 -1.57
1.52 22.49 -1.58
1.52 22.48 -1.59
1.54 22.47 -1.60
1.56 22.46 -1.60
1.57 22.45 -1.61
1.57 22.44 -1.62
1.58 22.44 -1.63
1.58 22.44 -1.64
1.59 22.43 -1.64
1.59 22.43 -1.65
1.59 22.43 -1.66
1.59 22.43 -1.67
1.60 22.43 -1.68
1.60 22.43 -1.69
1.59 22.43 -1.70
1.59 22.44 -1.71
1.59 22.44 -1.72
1.58 22.45 -1.73
1.57 22.46 -1.74
1.54 22.48 -1.75
1.45 22.53 -1.55
1.48 22.50 -1.56
1.50 22.49 -1.57
1.50 22.49 -1.57
1.51 22.48 -1.58

Subject: missing z axis

From: Steven_Lord

Date: 31 May, 2011 13:35:46

Message: 6 of 6



"nman2084 " <ng2084@yahoo.com> wrote in message
news:is14js$brg$1@newscl01ah.mathworks.com...
> Data is x, y, z values in txt file.
>
> num_open = input('Enter the number of files to process ');
> m = num_open;
>
> % create cells for variables
> dat = cell(1,m);
> x = cell(1,m);
> y = cell(1,m);
> z = cell(1,m);
> verts = cell(1,m);
> faces = cell(1,m);
> vol_litr= cell(1,m);
> vol_gal = cell(1,m);
> K = cell(1,m);
> v = cell(1,m);
> fn = cell(1,m);
> pn = cell(1,m);
> file = cell(1,m);
>
> fout= ['rockVolume.txt']; fid2 = fopen(fout,'a');
>
> hold on;

I believe this is the problem.

http://www.mathworks.com/help/techdoc/ref/hold.html

"hold on retains the current plot and certain axes properties so that
subsequent graphing commands add to the existing graph. If no current axes
exist before you call hold on, MATLAB creates new axes and retains the
default properties. "

Those "certain axes properties" include the view of the axes that is
displayed. Assuming no axes existed prior to your HOLD call, the default
axes view is a 2D plot and so that will be "locked in" by the HOLD command.

You can either create the axes in 3D view prior to calling HOLD (by calling
PLOT3 or SURF or another 3D plotting function) or explicitly change the
viewpoint to a 3D view using the VIEW function.

http://www.mathworks.com/help/techdoc/ref/view.html

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us