Best way to truncate imported data so the plot displays the area of interest

58 views (last 30 days)
I'm writing a simple script that runs a massive amount of data (over a million rows) through two equations and plots the results. What I need is a way to have matlab chop off a good portion of the beginning and end of the data without editing the original .csv file or going through and doing so while importing the data. Right now it's not plotting enough of the data to reach the point of interest. I was advised to try a premade function called getArrayEditorBrushCache to have it brush the parts of data I want but I'm pretty new to matlab and I'm not sure how to set that function up for use. Does anyone know any easy way around this? This will eventually be turned into a GUI.
  3 Comments
Meliton Flores
Meliton Flores on 22 Dec 2020
That's the size of my data. Some background: it's the voltage reading from an oscilliscope in microseconds. We are trying to set up the code so that someone can just take all the data from a scope and plug it right into the GUI and get the activity they tested for plotted.
In this certain test the area of interest is between 60 and 70 micro seconds. The time before the start of the test takes up the majority of the plot. The ability to choose the parts of the data interactively is desireable. Maybe a slider tool to make limits on the data.

Sign in to comment.

Accepted Answer

per isakson
per isakson on 23 Dec 2020
Edited: per isakson on 23 Dec 2020
One simple interactive way (R2018b)
%% some data
noise = rand( 0.5e6, 1 );
roi = 4.5*sin( (1:5e3)/(20*pi) )';
data = [ noise; roi; noise ];
x = 0.2 * ( 1 : numel(data) )';
%%
plot( x, data )
creates this figure. Clicking in the diagram displays the tool-buttons in the upper right corner.
Click the leftmost tool and select the interesting part. (Print screen doesn't capture all details.)
Right click in the selected area and choose Remove Unbrushed
Repeat the above step to narrow down the region
And click in the diagram to remove the "brushing". Done!
Next see App Building and search the File Exchange for tag:slider and more.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!