Date: Mar 28, 2013 3:11 PM
Author: Barry Williams
Subject: Re: xlsread not working with Excel 2010

"Tamas " <t.parkanyi@ed.ac.uk> wrote in message <kj0t8i$46h$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I've been working on a bit of code to read to separate *.csv files, and merge them together and do some analysis. I managed to get this working using xlsread on Matlab 7 with Excel 2003 on my work computer, but this doesn't work with Matlab 2010b and Excel 2010.
>
> I struggle to import the data using any other method, it doesn't seem to separate the csv file for me for some reason.
>
> A bit of the .csv looks like this:
>
> File : C:\USERS\DEBEN USER\DESKTOP\TESTS\NEW PLATFORM\RUBBER ON AL CSEPEL REPEAT TESTS\REPEAT SECOND GO\TEST 2 DEB.CSV saved 25/03/2013 at 10:39:40
> Sample : Default
> Span : 10.0
> Width : 5.0
> Thickness : 1.0
> Start Sampletime : 100ms
> Start Speed : 20mm/min
> Gain : x1
> Video file :
> Scale : 0.078
> Number of points : 309
> Ver6.1.83
> Tensile
>
>
> Test duration : 30.9000000000002s
> Max travel : 9.992mm
> Max extension : 0.000mm
> Comment : 200N single leadscrew tensile with 67:1 gearbox & 256 line encoder. Calibrated at 20N. Trip set to 20N
> Point,"Elongation","Force","Position","Code","Samplerate","Motorspeed"
> .1,-10.068,.023,.0032,2,100,"20mm/min"
> .2,-10.068,.024,.0032,0,100,"20mm/min"
> .3,-10.068,.024,.0032,0,100,"20mm/min"
> .4,-10.068,.015,.0032,0,100,"20mm/min"
> .5,-10.068,.062,.0032,0,100,"20mm/min"
> .6,-10.059,.198,.0117,0,100,"20mm/min"
> .7,-10.039,.415,.0322,0,100,"20mm/min"
> .8,-10.015,.614,.0557,0,100,"20mm/min"
> .9,-9.991,.801,.0803,0,100,"20mm/min"
> 1,-9.962,.973,.109,0,100,"20mm/min"
>
>
> I understand that the during importing I had to take care of the last column, because that's a string. This throws Matlab off, but I haven't been able to find a solution that works better than xlsread:
>
> I wrote
>
> data = xlsread(file_DEBEN);
>
> which worked fine until tried on the later combination.
>
> Would there be another, Excel independent way of reading this CSV into a matrix of doubles, disregarding, or stripping the string from the last column?
>
> Thank you!
> tamas


I'm assuming you have tried csvread. If that's the case:

fid=fopen('csv_file.csv','r');
data=textscan(fid,'%n %n %n %n %n %n %s','delimiter',',');
fclose(fid);

It worked with your data when I tried it.

Alternatively, save as .xls files. Because I don't have a version of ML that will read .xlsx files, I routinely do that.

Best,
Barry