Extracting specific column of values using regexp

I am currently trying to extract the X, Y, Z values from a .txt file. Any help is greatly appreciated!

댓글 수: 3

KSSV
KSSV 2016년 9월 6일
Have you tried converting .txt file into excel/csv so that things can be easy?
I have :) Unfortunately, whilst it helped fix the delimination and presented the data more nicely, I didn't find that it made it any easier for me extract the data. Of course I'm a novice so I could be missing something! Is there anything you'd suggest?
Rather than a screenshot of a text file (with which we can't experiment), attach an actual file.

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

답변 (1개)

Guillaume
Guillaume 2016년 9월 6일
Your text file looks fairly ordinary. Matlab shouldn't have much problem importing using one of its many functions. Probably, the simplest would be to use readtable.
Without a file, I can't test but I believe
t = readtable('yourfile', 'HeaderLines, 1, 'Delimiter', 'tab')
should work, assuming you give it the right delimiter.

댓글 수: 1

@Dhani Dharmaprani: it is usually much faster and simpler to read all of the data, and then use basic MATLAB indexing afterwards to select that data that you need.

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

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

질문:

2016년 9월 6일

편집:

2016년 9월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by