Importing .xyz Data Files

조회 수: 47 (최근 30일)
Ian Wood
Ian Wood 2011년 11월 19일
답변: Duarte Guerreiro 2021년 3월 16일
Hi,
I am having trouble with importing an .xyz data file I got from a 3D laser scanner. MATLAB didn't support the ".xyz" file extension, so I had to convert it to a ".txt" file. After I did this, I got rid of irrelevant text, which obviously couldn't be put into an Nx3 matrix. Anyway, when I try to import this file it comes up with the following error:
> importdata('LS_scan.txt')
Warning: An unexpected format mismatch was detected.
Please check results against original file.
> In importdata>parse at 485
In importdata>LocalTextRead at 267
In importdata at 210
In LS_nov19 at 7
I am not sure what went wrong. Can somebody help me? My goal is to see the data read as an Nx3 matrix, which I can use to separate into x, y, and z columns of data.
If you need more information on the error posted, please let me know and I will provide it.
Thank you
  댓글 수: 2
Sven
Sven 2011년 11월 19일
What does the contents of your file look like? All we know is:
1. It used to have an .xyz extension
2. It now has a .txt extension
3. It now has some things deleted
None of those things show us what the actual contents of the file are... and the contents of the file is the single most important piece of information.
Ian Wood
Ian Wood 2011년 11월 20일
My apologies. The file consists mostly of floating point numbers. Three of them, with a space in between each in each row. This is done for thousands of rows. Occasionally, there is a single integer between some of these rows. Maybe this will help clarify:
0
-49.338 516.802 963.547
-49.715 516.804 963.468
-50.092 516.805 963.383
.
.
1
174.914 517.007 963.776
174.150 517.005 963.845

댓글을 달려면 로그인하십시오.

채택된 답변

Michael
Michael 2011년 11월 20일
I think the first line of your text file should be in the same format as the data; in your example the first row is a single zero which matlab would read, and deduce that there is only one column.
  댓글 수: 1
Ian Wood
Ian Wood 2011년 11월 20일
Yup that fixed that problem. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Ian Wood
Ian Wood 2011년 11월 20일
I'm getting the data to output in the proper data type now, with the proper number of rows, but for some reason the command reads one fewer column.

sachini dehigaspitiya
sachini dehigaspitiya 2016년 11월 5일
Price per Unit (Rs/Wh) Time of Operation for DR event (min) Consumed Watt at ON mode (Watt) 2.25 60 75 2.975 45 85 4 30 100 4.5 40 100 4.6 30 115 5.175 40 115 8.1 30 180
i want to draw this data in to XYZ plot (3D plot)

Duarte Guerreiro
Duarte Guerreiro 2021년 3월 16일
Hello, Ian,
I am having the same problem. Could you share the script you used to import the data?
Thank you,
Duarte

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by