From: jrenfree on
I have both .xls and .csv files but am having trouble importing the
data. I like to import either only one whole column or row, but can't
find out how to specify that without hardcoding. Even with
hardcoding, I can't import the data. I've tried using xlsread,
csvread, textread, uiimport....nothing works. The closest I've got
is:

pings = csvread(file,1,0,[1,0,100,0])

in order to try and read the first 100 (well I guess 101) entries from
the first column, although it's got the ordering wrong. The values I
really want end up being in every other entry, but it's pulling out
bad values from some other column.

The data is comma delimited, had one header row (although the number
of headers does not equal the number of columns that are actually
used), and is quite large.

If anyone thinks they might know how to help me, please let me know
and I can try sending you an example of the data file to try it out.

Thanks,

-Josiah
From: ImageAnalyst on
On May 5, 8:15 pm, jrenfree <jrenf...(a)gmail.com> wrote:
> I have both .xls and .csv files but am having trouble importing the
> data.  I like to import either only one whole column or row, but can't
> find out how to specify that without hardcoding.  Even with
> hardcoding, I can't import the data.  I've tried using xlsread,
> csvread, textread, uiimport....nothing works.  The closest I've got
> is:
>
> pings = csvread(file,1,0,[1,0,100,0])
>
> in order to try and read the first 100 (well I guess 101) entries from
> the first column, although it's got the ordering wrong.  The values I
> really want end up being in every other entry, but it's pulling out
> bad values from some other column.
>
> The data is comma delimited, had one header row (although the number
> of headers does not equal the number of columns that are actually
> used), and is quite large.
>
> If anyone thinks they might know how to help me, please let me know
> and I can try sending you an example of the data file to try it out.
>
> Thanks,
>
> -Josiah

------------------------------------
Josiah:
Why do you want to do this? It's probaby faster if you just suck up
the whole array into memory and extract the information you need out
of there rather than going back to the disk file each time. Sure, the
hard drive cache may speed it up but if you've gone on to read
something else then you won't have the correct sector in the cache
anymore and you'll have to get it off the actual disk again. This
would slow things down. I regularly read in several hundred megabytes
into single MATLAB arrays so don't let the size of your csv file worry
you. I still think you're better off getting the whole thing and
sorting it out in memory rather than thrashing the disk with multiple
reads.
Regards,
ImageAnalyst
From: Bob on
If your data is not only CSV but fixed format (commas always in same
columns on ALL rows) then you might be able to use MEMMAPFILE to do
what you want. Basically, that would help manage the stride between
elements as you slice it one way or another on read.

Cheers
Bob