How to convert string data to cells ?

조회 수: 1 (최근 30일)
azizullah khan
azizullah khan 2014년 10월 31일
댓글: Geoff Hayes 2014년 11월 2일
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
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개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by