retrieve particular time data from .txt file

1 view (last 30 days)
the text file time and votlage values from 0.5sec to 0.55sec
but i need extract 0.52sec to 0.54sec from this txt file
how to code this one?
this is code i used to extract the column separately. I need values from particular time period?
please help me to get resolve the issue

Accepted Answer

Image Analyst
Image Analyst on 14 Jan 2021
Edited: Image Analyst on 14 Jan 2021
Did you try
% Read in data from text file with readmatrix()
data = readmatrix('t2.txt');
% Extract time into vector t, and the signal into vector y.
y = data(:, 1);
t = data(:, 2);
% Find out what indexes are between time1 and time2.
time1 = 0.52;
time2 = 0.54;
indexes = (t >= time1) & (t <= time2);
% Extract only those data into new vectors.
yExtracted = y(indexes);
tExtracted = t(indexes);
Image Analyst
Image Analyst on 15 Jan 2021
If you have trouble with the answers already provided there, then say so and show why.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by