How to convert string data to cells ?

1 visualizzazione (ultimi 30 giorni)
azizullah khan
azizullah khan il 31 Ott 2014
Commentato: Geoff Hayes il 2 Nov 2014
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 Commenti
azizullah khan
azizullah khan il 1 Nov 2014
Modificato: azizullah khan il 1 Nov 2014
@ 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 il 2 Nov 2014
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by