Hi, I am trying to import data files that have multiple delimiters. For example, the first data line is: 1.3001 3.5602 Importing the data file and using tab delimited give me column 1 of 1.3001 and column 2 of 3.5602. This is fine, as the second column is actually the decimal number of 3.5602. However, column 1 needs split up into a column that would include 1 and a column that would include 3001. Simply trying to use both tab and '.' delimiting will give me four columns, of 1, 3001, 3, and 5602; I need 3 columns of 1, 3001, and 3.5602. Any suggestions?

2 件のコメント

sixwwwwww
sixwwwwww 2013 年 10 月 11 日
First import all data using tab delimiter then you can use '.' delimiter on first column only. It will give you desired 3 columns
Mason
Mason 2013 年 10 月 11 日
I have been importing the data using the tab delimiter, but I am not familiar with how to use a delimiter like '.' on a particular column. I'm not that familiar with Matlab :(

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

 採用された回答

sixwwwwww
sixwwwwww 2013 年 10 月 11 日

0 投票

Here is an example of using dot delimiter:
a = 599.666;
b = num2str(a);
c = strsplit(b, '.');
first_element = str2num(c{1})
second_element = str2num(c{2})

2 件のコメント

Mason
Mason 2013 年 10 月 11 日
Thanks for your help on this. It makes intuitive sense. However, the program keeps spitting back at me "undefined function 'strsplit' for input arguments of type 'char'" and when I type "help strsplit" it says it's not found?
sixwwwwww
sixwwwwww 2013 年 10 月 11 日
編集済み: sixwwwwww 2013 年 10 月 11 日
Which version of MATLAB are you using? You can also find help for it online: http://www.mathworks.com/help/matlab/ref/strsplit.html

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

タグ

質問済み:

2013 年 10 月 11 日

コメント済み:

2013 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by