I have thousand lines of positions in .xyz format and im beginner in matlab. I need X, Y, Z matrix from this and make 3d graph.

 Réponse acceptée

the cyclist
the cyclist le 6 Jan 2023

0 votes

I don't know of any native MATLAB support, but it looks like the user-contributed atom submission might help you.

5 commentaires

Isnt there just simple way to make matrix of x, y z like i found a question when person needs an .xyz file format from matricies. I need the opposite.
I don't actually know what the *.xyz fileformat looks like, and I could not be certain from what I found on the web. Is this the format you mean? Can you upload a small example? (You can use the paper clip icon in the INSERT section of the toolbar to attach files here.)
Also, after you manage to read it in, I'm guessing that plot3 will be the function you want to use for plotting, but it's hard to know for sure. You can look at the MATLAB Plot Gallery to find plot examples, with the code used to create them.
Sorry im late. The file has some mess on beginning. And lot of lines has 'no data' in z coordinate.
Looking at the header, it seems this file originates from Zygo software. This page on their web site indicates that you can "send your data to Matlab with provided sample code". It might be helpful to follow up with them.
It's a bit annoying to write code to parse this from scratch (especially not knowing how much the header might change, etc.
Personally, I would probably use the "Import Data" tool from the command window, to import the file. Depending on how many files I needed to import, and how consistent in format they are, I would have the tool write a function for the import.

Connectez-vous pour commenter.

Plus de réponses (1)

Steven Lord
Steven Lord le 6 Jan 2023

0 votes

There's a website that lists what applications create files with various extensions. Searching for .xyz on that site lists seven different applications that could generate such a file (using "applications" a bit loosely here) with number 3 being:
"Graph Coordinates
A number of CAD programs work with .XYZ files which are comma delimited text files containing just xyz coordinates of points in space. The free program DXF2XYZ converts a DXF file to an XYZ file. Some other 3D scanners also use this format. RapidForm Free Viewer may be able to view them. This file format is classified as Text."
Is this the definition of ".xyz format" that you're using in your question?
Does your specific .xyz file format have any sort of header information included or is it just a list of three numbers separated by commas over and over again? As long as it's "nicely" formatted (no blank lines in the middle that interrupt the regularity of the file, for example) I'd probably try calling readmatrix first.

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by