Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ERC ERC is offline
external usenet poster
 
Posts: 4
Default data reduction--goal:unique time data only

I am a total Excel/programming novice. I am having a lot of trouble
constructing the simplest macro, and I would love some help. What I
have is a piece of equipment that records the time and extention of a
sample six times a minute, so that the extracted data is something
like:

A B
0.0000 -8.1000e-3
0.0100 -4.5000e-3
0.0100 -1.8000e-3
0.0100 -1.5000e-3
0.0200 -1.8000e-3
0.0200 -1.4000e-3
0.0200 -1.5000e-3
0.0300 -1.0000e-3
0.0300 5.0000e-4
0.0300 2.7000e-3
0.0400 3.7000e-3

Obviously, if this recording goes on for hundreds of hours, it would
result in way to many points to be meaningful. I need to write a macro
that either identifies unique times (I've tried sorting for unique
values, but since the data in column B is different, this doesn't work)
and only retains one point per minute, or, best case scenario, compares
the difference in B column values, and only retains points that meet a
certain minimum difference, so that I only keep points that change
the inflection of the curve. I only need a basic shape; reducing each
data set to 100 points or so would be ideal.

Any help would be fabulous; I'm a graduate student with no experience
in this area whatsoever.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default data reduction--goal:unique time data only

Where does this data get placed? In a file? Is it already sorted by time
(col A)?

A hundred hours would be more than 36k datapoints, so to end up with 100
points would only need one point in every 360 points or more. What type of
change are you looking for in terms of time scale ? Are you expecting a
monophasic curve or is it likely to fluctuate ?

You might start just by opening the source data as a text file and reading
every 100th line or so: plot that and see how it looks.

Tim.


"ERC" wrote in message
ups.com...
I am a total Excel/programming novice. I am having a lot of trouble
constructing the simplest macro, and I would love some help. What I
have is a piece of equipment that records the time and extention of a
sample six times a minute, so that the extracted data is something
like:

A B
0.0000 -8.1000e-3
0.0100 -4.5000e-3
0.0100 -1.8000e-3
0.0100 -1.5000e-3
0.0200 -1.8000e-3
0.0200 -1.4000e-3
0.0200 -1.5000e-3
0.0300 -1.0000e-3
0.0300 5.0000e-4
0.0300 2.7000e-3
0.0400 3.7000e-3

Obviously, if this recording goes on for hundreds of hours, it would
result in way to many points to be meaningful. I need to write a macro
that either identifies unique times (I've tried sorting for unique
values, but since the data in column B is different, this doesn't work)
and only retains one point per minute, or, best case scenario, compares
the difference in B column values, and only retains points that meet a
certain minimum difference, so that I only keep points that change
the inflection of the curve. I only need a basic shape; reducing each
data set to 100 points or so would be ideal.

Any help would be fabulous; I'm a graduate student with no experience
in this area whatsoever.



  #3   Report Post  
Posted to microsoft.public.excel.programming
ERC ERC is offline
external usenet poster
 
Posts: 4
Default data reduction--goal:unique time data only

The data is in a comma delimited file. I don't necessarily want to
read from those raw files; usually there are bad readings that have to
be deleted by hand first. I already have most of these sets in excel
files already. The changes I am looking for are large changes in the B
column (extension) because the samples demonstrate three regions of
different slopes. However, it doesn't need to be this complicated; I'd
be happy with a macro that read every point that differed from the
point before it by 0.01(the data in B is total elongation).

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default data reduction--goal:unique time data only

Sub reducedata()
Dim rng as Range
Set rng = Range("B2")
Do While Not IsEmpty(rng.Offset(1, 0))
Do While Abs( _
rng - rng.Offset(1, 0)) < 0.01
rng.Offset(1, 0).EntireRow.Delete
Loop
Set rng = rng.Offset(1, 0)
Loop
End Sub

--
Regards,
Tom Ogilvy



"ERC" wrote in message
oups.com...
The data is in a comma delimited file. I don't necessarily want to
read from those raw files; usually there are bad readings that have to
be deleted by hand first. I already have most of these sets in excel
files already. The changes I am looking for are large changes in the B
column (extension) because the samples demonstrate three regions of
different slopes. However, it doesn't need to be this complicated; I'd
be happy with a macro that read every point that differed from the
point before it by 0.01(the data in B is total elongation).



  #5   Report Post  
Posted to microsoft.public.excel.programming
ERC ERC is offline
external usenet poster
 
Posts: 4
Default data reduction--goal:unique time data only

I have been looking at syntax and a few intro books, but I am still
having a little trouble consistently implementing this--half the time
there's a "type mismatch," sometimes it won't stop looping (the data is
reduced, but the program continues to run) and sometimes it works. I'm
a little confused. Any help would be appreciated.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default data reduction--goal:unique time data only

It helps if you post what code you're having problems with: many people
reading this group using a newsreader (me included) will not see any
messages they've already read, so your message appears by itself with no
other context...

tim

--
Tim Williams
Palo Alto, CA


"ERC" wrote in message
ups.com...
I have been looking at syntax and a few intro books, but I am still
having a little trouble consistently implementing this--half the time
there's a "type mismatch," sometimes it won't stop looping (the data is
reduced, but the program continues to run) and sometimes it works. I'm
a little confused. Any help would be appreciated.



  #7   Report Post  
Posted to microsoft.public.excel.programming
ERC ERC is offline
external usenet poster
 
Posts: 4
Default data reduction--goal:unique time data only

I am having problems executing the code below--sometimes it chooses to
infinitely loop, but I'm not sure where it's getting stuck. I was
wondering if it might be a better idea to set an integer to increment
through each cell until instead of defining it as a range or else nest
an an "if" statement somewhere to prevent looping. The goal of this
macro is just to cut out measurements that have close values.
Unfortunately, I have only a dim recollection of C++ and I'm finding
the syntax difficult.




Sub reducedata()
Dim rng as Range
Set rng = Range("B2")
Do While Not IsEmpty(rng.Offset(1, 0))
Do While Abs( _
rng - rng.Offset(1, 0)) < 0.01
rng.Offset(1, 0).EntireRow.Delete
Loop
Set rng = rng.Offset(1, 0)
Loop
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filer for unique records and return all column data for unique rec bseeley Excel Discussion (Misc queries) 1 September 12th 09 12:17 AM
comparing two columns of data and return unique data in another co ExcelUSER Excel Discussion (Misc queries) 6 June 18th 09 02:10 PM
Adding data to existing data that has a unique number in column Lars Excel Discussion (Misc queries) 3 June 28th 07 11:48 AM
Average data/reduction MC New Users to Excel 2 January 9th 06 03:19 PM
Goal Line in chart but not on data tabel BMSpell Charts and Charting in Excel 1 February 1st 05 06:41 PM


All times are GMT +1. The time now is 02:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"