VBA Array Reshape/Interpolate/Condense Input Data
Posted on 2015-02-15
I'm not sure how to explain my problem in terms of general VBA functions. But here's what I want. Say I have an input data like this:
But I want to reshape/interpolate/condense/adjust the step size of the data to look like this:
Ignore the fact that I used a formula to generate the above results. The data I will be manipulating is being read via text file, not excel.
I want to be able to specify at what delta/step size I'd like the new array to have. Some additional details: linear interpolation of the results is fine, spline would be nice, but definitely not a deal breaker. The data is always continuous and sorted in the X axis, starting at 0 going to some maximum, say 8500. The data is exported from a vendor software that I use, and it could be in arbitrary step sizes from 0.1 to 10 based on the settings that the user had set at the time of export. The text files can approach 5 MB, and I typically only want certain specific (but changing) values from the text file. The values I want are typically multiples of 100, say 1000, 3000, 4500, 6600, etc. For this particular application, I could be looking up ~15 values from 15 different large text files, and I know that using the current data as exported will take too long. In order to keep from looking up/interpolating the specific values I want from a large text file, I'd like to be able to cut out a lot of the data and resave it to a much smaller text file to make it easier to handle on an as needed basis. Whenever a value is needed in my particular application, I'll just look it up in the newer, much smaller text file.
I could probably figure it out over some time, but I'd like for the solution to be efficient, and I'm well aware that I'm not enough of a wizard to create a speedy solution for this particular problem. Any help is much, much appreciated.