Thread Subject: Extract a specific portion of data from csv file

Subject: Extract a specific portion of data from csv file

From: Divakar

Date: 16 Oct, 2009 20:07:02

Message: 1 of 4

Hi

I am new to matlab Programing.

I am reading data from the csv file using textscan. ( file has 5 columns and 5000 rows with first column being dates and other columns are observations made on that date. )

Now i want to extract only the information (all columns ) starting from a specific date To a specific date and not all 5000 rows.
 
How do i do this?.. any inputs will be of great help.

Just for the information : I am trying to read many similar csv files (with different number of rows but same number of columns ) in a loop. At the end .. after being able to extract information between 2 specified dates from all the files ( to ensure the matrix dimensions are the same ) , i would like to add them up.

Thanks
Divakar

Subject: Extract a specific portion of data from csv file

From: Rune Allnor

Date: 16 Oct, 2009 20:14:43

Message: 2 of 4

On 16 Okt, 22:07, "Divakar " <divakar.chitt...@asu.edu> wrote:
> Hi
>
> I am new to matlab Programing.
>
> I am reading data from the csv file using textscan. ( file has 5 columns and 5000 rows with first column being dates and other columns are observations made on that date. )
>
> Now i want to extract only the information (all columns ) starting from a specific date To a specific date and not all 5000 rows.
>
> How do i do this?..

The simple way is to read all the data as usual,
and the throw away the data you don't want.

Rune

Subject: Extract a specific portion of data from csv file

From: Divakar

Date: 17 Oct, 2009 19:47:03

Message: 3 of 4

Hi

Thanks for the reply
But i am stuck at that point on trying to have the required information. How do i do it? Because after i extract using the textscan. . each column holds different data for one specific date. Now the filtering is purely based on the date and hence all the columns on those band of dates have to be selected, which tells me that ,, it is best to filter in the first place when i am trying to extract rather than filtering after i get the whole data. Kindly suggest

Thanks


Rune Allnor <allnor@tele.ntnu.no> wrote in message <11c595f7-be00-4dd1-ad5c-830bb35a68bf@k33g2000yqa.googlegroups.com>...
> On 16 Okt, 22:07, "Divakar " <divakar.chitt...@asu.edu> wrote:
> > Hi
> >
> > I am new to matlab Programing.
> >
> > I am reading data from the csv file using textscan. ( file has 5 columns and 5000 rows with first column being dates and other columns are observations made on that date. )
> >
> > Now i want to extract only the information (all columns ) starting from a specific date To a specific date and not all 5000 rows.
> >
> > How do i do this?..
>
> The simple way is to read all the data as usual,
> and the throw away the data you don't want.
>
> Rune

Subject: Extract a specific portion of data from csv file

From: NZTideMan

Date: 18 Oct, 2009 19:02:24

Message: 4 of 4

On Oct 18, 8:47 am, "Divakar " <divakar.chitt...@asu.edu> wrote:
> Hi
>
> Thanks for the reply
> But i am stuck at that point on trying to have the required information. How do i do it? Because after i extract using the textscan. . each column holds different data for one specific date. Now the filtering is purely based on the date and hence all the columns on those band of dates have to be selected, which tells me that ,, it is best to filter in the first place when i am trying to extract rather than filtering after i get the whole data. Kindly suggest
>
> Thanks
>
> Rune Allnor <all...@tele.ntnu.no> wrote in message <11c595f7-be00-4dd1-ad5c-830bb35a6...@k33g2000yqa.googlegroups.com>...
> > On 16 Okt, 22:07, "Divakar " <divakar.chitt...@asu.edu> wrote:
> > > Hi
>
> > > I am new to matlab Programing.
>
> > > I am reading data from the csv file using textscan. ( file has 5 columns and 5000 rows with first column being dates and other columns are observations made on that date. )
>
> > > Now i want to extract only the information (all columns ) starting from a specific date To a specific date and not all 5000 rows.
>
> > > How do i do this?..
>
> > The simple way is to read all the data as usual,
> > and the throw away the data you don't want.
>
> > Rune

First of all, please don't top post. It makes the thread hard to
follow.
Put your reply UNDERNEATH.

Figure out which rows you don't want and put the row numbers in a
vector:
ibad=[1:10 300:5000]';
Now, for the other columns, you just zap those rows:
c{2}(ibad)=[];
c{3}(ibad)=[];

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
textscan Divakar 16 Oct, 2009 16:09:08
csv files Divakar 16 Oct, 2009 16:09:08
extract Divakar 16 Oct, 2009 16:09:08
rssFeed for this Thread

Contact us at files@mathworks.com