Best way to truncate imported data so the plot displays the area of interest
54 views (last 30 days)
Show older comments
Meliton Flores
on 22 Dec 2020
Commented: Meliton Flores
on 23 Dec 2020
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
Accepted Answer
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!
More Answers (0)
See Also
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!