How to export a number of strings in a csv file

조회 수: 21 (최근 30일)
Saugata Bose
Saugata Bose 2018년 11월 6일
댓글: b 2020년 12월 3일
Hello I am working on text analytics in matlabR2017b. Currently, I have a 25 data in csv format. After some preprocessing on these data, I have generated tokenizedDocument data.
cleanData=preprocess(textData);
disp(class(cleanData));% cleanData is tokenizedDocument type
Now I would like to export these data in a csv file along with the length of each document.I have read few posts regarding these exporting and I did not found any relevant post to export tokenizedDocument data to csv file. So I have tried to explore the opportunities of dlmwrite/csvwrite in my program. I have tried these as folloing:
cD=joinWords(cleanData);%to convert from tokenizedDocument to string
Now, would you please suggest me how to export these data along with the length of each string to a csv file?
Thanks,
  댓글 수: 3
Saugata Bose
Saugata Bose 2018년 11월 6일
@madhan ravi: great. its working perfectly. can u pls explain the idea behind this? and if I want to include length of each string to te file, how could it be possible? And last thing is, is it possile to do this using fopen, fprintf?.I am sorry for theses large added queries.
madhan ravi
madhan ravi 2018년 11월 6일
Ok let me put in the answer section so you can accept it

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2018년 11월 6일
편집: madhan ravi 2018년 11월 6일
c=char({'hi','there'})
dlmwrite('c.csv',c,'delimiter','')
dlmwrite just writes each cell with a new line
  댓글 수: 5
madhan ravi
madhan ravi 2018년 11월 6일
@Stephen thank you edited it :)
b
b 2020년 12월 3일
This puts the first string 'hi' in A1, and the second string 'there' in A2 (in excel notations, when this csv file is opened in excel).
How to put the first string in A1, and the second string in B1 (instead of A2)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by