Extracting specific column of values using regexp

1 回表示 (過去 30 日間)
Dhani Dharmaprani
Dhani Dharmaprani 2016 年 9 月 6 日
編集済み: Dhani Dharmaprani 2016 年 9 月 9 日
I am currently trying to extract the X, Y, Z values from a .txt file. Any help is greatly appreciated!
  3 件のコメント
Dhani Dharmaprani
Dhani Dharmaprani 2016 年 9 月 6 日
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?
Guillaume
Guillaume 2016 年 9 月 6 日
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 件のコメント
Stephen23
Stephen23 2016 年 9 月 6 日
@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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by