Data Analysis - need to omit certain values from an array as well as resample

ok...so this is a problem i've been working with for a while...my current problem is with a for loop...i'm trying to omit data from my array based on its value...so if it is above a specific value it is taken out of the array..i'm quite sure that it is easy to fix the error i'm getting but i'm stumped because i can't figure out why i'm getting the error in the first place (if that makes sense)....so this is what i have...
for i = 1:length(data)
if data(i) > max_value
data(i) = [];
end
end
the error i'm getting is that it cannot access data(55) and my data length in 54....so i'm unsure why it is trying to access element 55 to begin with and what would i do to fix this error or is there a better way to do what i'm trying to do??
i have another problem that i'm working with...same project actually...once i have the data with the right values i then need to resample it so that all data for that experiment has the same number of elements so that they can be compared and analyzed....this needs to be done because the different data collections were not all done with the same step size so some files have different more data points than others....so my problem with this is i have to do this generically so that the code will work for different files (they don't vary in the step sizes consistently)...so for example for one case i may need to take out every other data point where others i may need to take out every third point....but i don't have to be exact which is why i need to find a generic way to write it so it will work for all experiment cases....for this i'm not even sure where to begin and have no idea how i could make this work for all cases....if there are any suggestion on where to start with this problem that would also be appreciated.....Thank you

标签

提问:

2012-2-20

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by