CSV files refuse to be read by Matlab -


i writing matlab program , initial stage involves calling .csv files within folders. reasons unkown, matlab not read files (checked using csvreader, dataimport , fopen). note-it csv file!

however, opened 1 of files, pressed 'save as', gave same name , fileformat. noticeable thing happened filesize reduced , matlab magically open have no idea why.

can shed light on why happening? open , resave files except data related large number of samples make manual process long. if of relevance, data outputted instron.

many :)

edit sample of 1 of files called '2mm.csv', opened using notepad (first 10 lines of ~111,000):

time,extension,load (s),(mm),(n) "0.00000","51.97554","0.09549" "1.00000","52.13438","0.24999" "2.00000","52.30102","0.13996" "3.00000","52.46782","0.19513" "4.00000","52.63449","0.15348" "5.00000","52.80097","0.26828" "6.00000","52.96780","0.32510" "7.00000","53.13446","0.67119" "8.00000","53.30105","4.56026" "9.00000","53.46772","17.80811" 

this code use open , result:

>> importdata('2mm.csv',',',2)  ans =       'time,extension,load'     '(s),(mm),(n)' 

note has captured first 2 lines , has not delimited comma.

so opened file in ms excel, saved 2mmv2.csv , put same code in. was given structure expected:

>> importdata('2mmv2.csv',',',2); >> ans.data(1:10,:)  ans =           0   51.9755    0.0955     1.0000   52.1344    0.2500     2.0000   52.3010    0.1400     3.0000   52.4678    0.1951     4.0000   52.6345    0.1535     5.0000   52.8010    0.2683     6.0000   52.9678    0.3251     7.0000   53.1345    0.6712     8.0000   53.3010    4.5603     9.0000   53.4677   17.8081 

while can call file, none wiser why case.

try this:

 file=fopen('test.csv');  c=textscan(file,'%f%f%f','headerlines',2,'collectoutput',true, ...      'delimiter', {',','"'},'multipledelimsasone',true);  fclose(file);  dat=c{1} 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -