From: Ayotunde on
Hey Tideman.....i tried what you said and my code looks like
>> fileID=fopen('244019298.csv');
>> C=textscan(fileID,'%s%q%c');
>> fclose(fileID)

i Honestly don't understand what i just did and how to move on from here :). I also did not know/understand what to use for conversion specifiers so i used %s%q%c, though i do not know what it means. I am a complete novice at matlab (my first attempt at some sort of programming/coding) so please understand.
Regards,
Ayotunde
From: TideMan on
On May 12, 9:23 am, "Ayotunde " <rhyme...(a)yahoo.co.uk> wrote:
> Hey Tideman.....i tried what you said and my code looks like
>
> >> fileID=fopen('244019298.csv');
> >> C=textscan(fileID,'%s%q%c');
> >> fclose(fileID)
>
> i Honestly don't understand what i just did and how to move on from here :). I also did not know/understand what to use for conversion specifiers so i used %s%q%c, though i do not know what it means. I am a complete novice at matlab (my first attempt at some sort of programming/coding) so please understand.
> Regards,
> Ayotunde

You did well!
But you need to tell textscan that there is one header line and that
the delimiter is comma:
c=textscan(fid,'%s%f%s%f%f%f%f%s',...
'headerlines',1,...
'delimiter',',');

Now your data are in a cell array.
To get the dates for example, do this:
date=c{2};
To convert the dates and times to Matlab days, do this:
t=datenum([num2str(date) char(c{3})],'yyyymmddHH:MM:SS');

From: Ayotunde on
TideMan <mulgor(a)gmail.com> wrote in message <1ab24aff-93d9-4d6e-b776-f5fdf46ad259(a)m31g2000pre.googlegroups.com>...
> On May 12, 9:23 am, "Ayotunde " <rhyme...(a)yahoo.co.uk> wrote:
> > Hey Tideman.....i tried what you said and my code looks like
> >
> > >> fileID=fopen('244019298.csv');
> > >> C=textscan(fileID,'%s%q%c');
> > >> fclose(fileID)
> >
> > i Honestly don't understand what i just did and how to move on from here :). I also did not know/understand what to use for conversion specifiers so i used %s%q%c, though i do not know what it means. I am a complete novice at matlab (my first attempt at some sort of programming/coding) so please understand.
> > Regards,
> > Ayotunde
>
> You did well!
> But you need to tell textscan that there is one header line and that
> the delimiter is comma:
> c=textscan(fid,'%s%f%s%f%f%f%f%s',...
> 'headerlines',1,...
> 'delimiter',',');
>
> Now your data are in a cell array.
> To get the dates for example, do this:
> date=c{2};
> To convert the dates and times to Matlab days, do this:
> t=datenum([num2str(date) char(c{3})],'yyyymmddHH:MM:SS');


Thank you, i did what you said and it looks like i am definately making some progress at least. However for some reason i am not sure of the first cell has values that alternate between SPY and A and this means that other cells which contain the values i need (date, time, prices) have values that alternate either between just an empty space or NaN. though i suppose i could find a way of picking every other value in each cell.
Thanks Tideman...you have been really helpul. also can you reccomend any books, ebooks, websites that i can read to improve my matlab ability as it is shockingly bad
From: TideMan on
On May 12, 11:03 am, "Ayotunde " <rhyme...(a)yahoo.co.uk> wrote:
> TideMan <mul...(a)gmail.com> wrote in message <1ab24aff-93d9-4d6e-b776-f5fdf46ad...(a)m31g2000pre.googlegroups.com>...
> > On May 12, 9:23 am, "Ayotunde " <rhyme...(a)yahoo.co.uk> wrote:
> > > Hey Tideman.....i tried what you said and my code looks like
>
> > > >> fileID=fopen('244019298.csv');
> > > >> C=textscan(fileID,'%s%q%c');
> > > >> fclose(fileID)
>
> > > i Honestly don't understand what i just did and how to move on from here :). I also did not know/understand what to use for conversion specifiers so i used %s%q%c, though i do not know what it means. I am a complete novice at matlab (my first attempt at some sort of programming/coding) so please understand.
> > > Regards,
> > > Ayotunde
>
> > You did well!
> > But you need to tell textscan that there is one header line and that
> > the delimiter is comma:
> > c=textscan(fid,'%s%f%s%f%f%f%f%s',...
> >             'headerlines',1,...
> >             'delimiter',',');
>
> > Now your data are in a cell array.
> > To get the dates for example, do this:
> > date=c{2};
> > To convert the dates and times to Matlab days, do this:
> > t=datenum([num2str(date) char(c{3})],'yyyymmddHH:MM:SS');
>
> Thank you, i did what you said and it looks like i am definately making some progress at least. However for some reason i am not sure of the first cell has values that alternate between SPY and A and this means that other cells which contain the values i need (date, time, prices) have values that alternate either between just an empty space or NaN. though i suppose i could find a way of picking every other value in each cell.
> Thanks Tideman...you have been really helpul. also can you reccomend any books, ebooks, websites that i can read to improve my matlab ability as it is shockingly bad

The symptoms suggest that your format is not quite right.
Check that you have the right number of %s and %f for each value in
the line. I suspect you're missing one of the %f's.
Post your textscan and we can check that.

I don't think reading books will improve your Matlab.
Doing it is better than reading about it.
And this forum is excellent. Read threads that are not apparently
relevant and you often find stuff that is useful in your application.
When I first started, I read anything posted by us (and I still do).
And providing you're prepared to have a go (as you've demonstrated
already), there are plenty of people here who will help you with your
coding problems.
But what really pisses people off is posters who make no effort and
say stuff like "I need the code for x, y, and z. It is really
urgent. Plz, plz, plz"

From: Ayotunde on
> The symptoms suggest that your format is not quite right.
> Check that you have the right number of %s and %f for each value in
> the line. I suspect you're missing one of the %f's.
> Post your textscan and we can check that.
>
> I don't think reading books will improve your Matlab.
> Doing it is better than reading about it.
> And this forum is excellent. Read threads that are not apparently
> relevant and you often find stuff that is useful in your application.
> When I first started, I read anything posted by us (and I still do).
> And providing you're prepared to have a go (as you've demonstrated
> already), there are plenty of people here who will help you with your
> coding problems.
> But what really pisses people off is posters who make no effort and
> say stuff like "I need the code for x, y, and z. It is really
> urgent. Plz, plz, plz"

I edited the format as you said and i was missing 1 of the %f's. Is %s used for strings maybe dates and time and %f for just numbers? Guessed where to out the missing %f and i'm getting something that looks sensible but insead of getting a 1x9 cell array with nine 360579x1 matrices, i am getting nine 27x1 matrices instead. I am sure its a small problem with my code so i copied it
>> fid=fopen('244019298.csv');
>> C=textscan(fid,'%s%f%s%f%f%f%f%f%s',...
'headerlines',1,...
'delimiter',',');
>> fclose(fid);
Yer i understand what you mean, I am certainly no saint myself but i can see where you are coming from, people like you are here to help not do the whole thing for us :)
thnx again