From: matlaberboy on
I understand that you can search a string.

What I want to do is simple: just put the whole contents of the CSV into a cell/ matrix structure.

thank you.
From: TideMan on
On Jun 22, 5:35 am, "matlaberboy " <matlaber...(a)gmail.NOSPAM.com>
wrote:
> I understand that you can search a string.
>
> What I want to do is simple: just put the whole contents of the CSV into a cell/ matrix structure.
>
> thank you.

fid=fopen(csvfile,'rt');
a=fscanf(fid,'%c');
fclose(fid);

Now everything, including commas and line-feeds, is in the string a.
You can parse it using the string functions: strfind, findstr and
strmatch.
First job is to look for line-feeds char(10).
These separate the lines.
Then you look for commas, which separate the data.
From: us on
TideMan <mulgor(a)gmail.com> wrote in message <254e945c-512d-45ce-9416-1d7743213148(a)d37g2000yqm.googlegroups.com>...
> On Jun 22, 5:35 am, "matlaberboy " <matlaber...(a)gmail.NOSPAM.com>
> wrote:
> > I understand that you can search a string.
> >
> > What I want to do is simple: just put the whole contents of the CSV into a cell/ matrix structure.
> >
> > thank you.
>
> fid=fopen(csvfile,'rt');
> a=fscanf(fid,'%c');
> fclose(fid);

derek, just a thought

a=fread(fid,inf,'*char').';

is (probably) much(!) faster...

urs
From: TideMan on
On Jun 22, 8:24 am, "us " <u...(a)neurol.unizh.ch> wrote:
> TideMan <mul...(a)gmail.com> wrote in message <254e945c-512d-45ce-9416-1d7743213...(a)d37g2000yqm.googlegroups.com>...
> > On Jun 22, 5:35 am, "matlaberboy " <matlaber...(a)gmail.NOSPAM.com>
> > wrote:
> > > I understand that you can search a string.
>
> > > What I want to do is simple: just put the whole contents of the CSV into a cell/ matrix structure.
>
> > > thank you.
>
> > fid=fopen(csvfile,'rt');
> > a=fscanf(fid,'%c');
> > fclose(fid);
>
> derek, just a thought
>
>      a=fread(fid,inf,'*char').';
>
> is (probably) much(!) faster...
>
> urs

You're right, us:
>> tic;a=fscanf(fid,'%c');toc
Elapsed time is 1.332797 seconds.
>> frewind(fid);
>> tic;b=fread(fid,inf,'*char').';toc
Elapsed time is 0.399964 seconds.
>>