How to select multiple ranges of plot data to a cell array

Hi, I have a data.xls file (see attachment). I use readtable to import the .xls file and I end up with a 21345x3 table. Here is the code that I use to import the data:
% Transfer all excel data to a table
filename = 'data.xls'; dataTable = readtable(filename);
figure;
plot(dataTable.Time_ms_,dataTable.dataAvgLeft);
hold on;
plot(dataTable.Time_ms_,dataTable.dataAvgRight,'r');
What I would like to do is take the red timeseries in the plot and focus on specific ranges of data. So for example, if you take a look at the figure below, I've circled the multiple ranges of interest in the plot. If I know that the majoriy of my red timeseries waveforms (from future data.xls files) will look like this, can I automate the selection process of these specific ranges so that I can transfer the data points in that range to a separate cell array for further processing?
Thank you for your time and feeback!

 Accepted Answer

Jos (10584)
Jos (10584) on 24 Sep 2014
Edited: Jos (10584) on 24 Sep 2014
Can you precisely formulate why you select those parts of the plot?

1 Comment

Hi Jos, Thanks for the reply! Why I select those parts of the plot is because that is the relevant information I need to calibrate a system I am working with. How I select those parts is the issue for me. I was thinking maybe I can loop through a column of data in dataTable like this:
for i=2:length(dataAvgRight)
if dataTable.dataAvgRight(i) - dataTable.dataAvgRight(i-1) > abs(Max Noise found in data?)
temp = dataTable.Time_ms_(i);
temp2 = [temp2;temp]; % Start and end points of ranges kept here
end
end
I should probably filter the data as well beforehand if I'm going to be looking for the max noise. I don't want there to be a noise spike that would have a delta greater than the change seen between the range of interest and the baseline. I don't know, these are just thoughts right now and I will try it out as soon as I'm back on my laptop. Let me know what you think if you have a moment. Thank you for your time Jos.

Sign in to comment.

More Answers (0)

Categories

Asked:

R J
on 24 Sep 2014

Commented:

R J
on 24 Sep 2014

Community Treasure Hunt

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

Start Hunting!