Importing data from text file

3 ビュー (過去 30 日間)
Andreas Volden
Andreas Volden 2015 年 1 月 30 日
回答済み: Rosi 2015 年 1 月 30 日
Hi!
I want to import data from a text file looking like this:
0 0.498102540633 0.235170603626 490.895642209.....
16 0.496103035619 0.156469393101 495.016403917.....
32 0.497132916139 0.184344917004 504.450161031.....
The problem is the spacing between the columns. It's not one regular tab delimiter, it's two. I can't seem to find a method that cope with this. By using "simple" commands that don't accept multi-charcter delimiters and just typing '\t' will result in a matrix where every second row is NAN.
Anyone who can help me with this?
Cheers

採用された回答

Star Strider
Star Strider 2015 年 1 月 30 日
If you are using textscan, you can use the 'MultipleDelimsAsOne',1 option among the name-value pair arguments.
  2 件のコメント
Andreas Volden
Andreas Volden 2015 年 1 月 30 日
Thank you, fine human!
Star Strider
Star Strider 2015 年 1 月 30 日
My pleasure!

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

その他の回答 (1 件)

Rosi
Rosi 2015 年 1 月 30 日
You can use the next fuction, too: A = load('NameFile.txt'); the information will be stored into variable A.

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by