How to convert string data to cells ?

I have Data in string form and want to convert that data to cells:
String Data =
(114) Ins = 4
Battery Checking Plus
Account number: 23455654 a73 July 1, 2014 - July 31, 2014 a73 Page 1 of 6
Questions?
Available by phone 24 hours a day, 7 days a week:
300-CALL-BAT (342-25-11)
TTY: 1-800-877-4833
En español: 1-877-337-7454
Online: Bat.com/biz
Write: Bat Fargo shop, N.A. (114)
P.O. Box 345
Portland, OR 9235-6223
Please help me in converting this data to cells with a delimiter of Tab Thanks:

3 件のコメント

Geoff Hayes
Geoff Hayes 2014 年 11 月 1 日
Is your string data the 12 lines above, or that including the blank/empty lines too? You mention how yu want to convert this data to cells with a delimiter of tab. What would be the output if you use your above example? What have you tried so far?
azizullah khan
azizullah khan 2014 年 11 月 1 日
編集済み: azizullah khan 2014 年 11 月 1 日
@ Geoff: Yes my string contain blank lines: I saved this data by
dlmwrite('some.txt',String Data,'');
Then y=importdata('some.txt','\t');
cell2csv('some.csv',a.textdata,'\t');
But it doesn't work because it only separate cells by using default delimiter comma (,) .And i want delimiter as a tab. i am in search of such code that will convert this string to cells with a tab as delimiter: Thanks for reply
Geoff Hayes
Geoff Hayes 2014 年 11 月 2 日
The syntax in your dlmwrite statement must generate an error since there is a space between String and Data. Your code then imports the data into a local variable y which is presumably a cell array, yet in cell2csv the code references a.textdata. It isn't clear how this code would work.
If I just copy your text data into a text file (as is), I suspect that y is a 23x1 cell array. So trying to use a delimiter on each line will do nothing since there is only one column in your cell array (if more than one, then a tab would separate each column).
I think that you need to better describe your problem, and indicate how you want the output to appear. Please show how you expect the tab delimiter to be used in your above text file example.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2014 年 10 月 31 日

コメント済み:

2014 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by