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

51 次查看(过去 30 天)
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 个评论
Meliton Flores
Meliton Flores 2020-12-22
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.

请先登录,再进行评论。

采纳的回答

per isakson
per isakson 2020-12-23
编辑:per isakson 2020-12-23
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by