I have a CSV file that has 3 columns having :
String type(This can be a word or a sentence), integer type, integer type [these are the column types]
Now I want to store this data into a matrix,where the string(the whole sentence is stored into one cell)and the integers in one cell each too. I tried this:
fileID=fopen('training.csv');
C=textscan(fileID,'%s %d %d');
But it gives each word of the sentence in a different cell!The whole sentecne should be stored in one cell.How do I do that?
Thank you.
EDIT:It does seem to read anything now,this is what I get
celldisp(C)
C{1}{1} =
jdl
C{2} =
[]
C{3} =
[]
EDIT:
jdl h-yf u ghjktnfhcrjuj hjcljd-yf-ljye 129771 196
EAS CJDTNCRBH YFIRJHNJCNFY UJH HTDL HTCG 819100 458
rcfcyjzcrjuj rfycrf u rhfz edl 547653 677
trfcthbyyehuf h-yt jnltkjv eavc xrfkjdcrjv u hjccbb d 970121 884
H-YF TRFNTHBYYEHUF U EDL XRFKJDCRJUJ 938870 630
jdl yfhyfek h-yf rtktpyjljhjryjuj 525855 598
rhfcyjzhcrf eghfdktybtv dyenhtyybq hfqjyf u ktybycrjuj 709215 403
Pretty much looks like this.It has 3500 rows of data
You could put the strings into quotation marks and then use %q in textscan:
EDIT: If you only need to do that once (and not automatically via script in another process), what about manually importing the data from the CSV-File into MATLAB (via the import-tool provided by matlab:
)
and then maybe save the imported variables simply to a MAT-file so you can access it easier in the future!?