Matlab: Textscan with blank spaces -


i have textfile formatted this:

3,4, ,cmx cop,jul11,abcd4,appm,cme,4pts09,f,hg,27, , ,1,4.3,2,27,23,1,ncap1,0 5,6, ,aud,jun11,abcd4,appm,cme,4pts09,f,6a,11, , ,1,1.7,10,27,23,1,ncap1,0 

i'm trying read textscan, don't know how deal blank spaces. tried:

filename = 'e:\20110427.csv';  fileid = fopen(filename,'rt'); data = textscan(fileid, '%d,%d,%c,%s,%s,%s,%s,%s,%s,%s,%s,%d,%c,%c,%d,%f,%d,%d,%d,%d,%s,%d') 

the space between cmx , cop seems throwing off, potentially blanks between commas. suggestions?

cmx cop 1 thing. okay delete space.

you need use 'delimiter' option textscan (i changed %c on spaces %s avoid reading delimiter).

str = '5,6, ,aud,jun11,abcd4,appm,cme,4pts09,f,6a,11, , ,1,1.7,10,27,23,1,ncap1,0'; data = textscan(str, '%d%d%s%s%s%s%s%s%s%s%s%d%s%s%d%f%d%d%d%d%s%d', 'delimiter', ','); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -