필터 지우기
필터 지우기

retrieve particular time data from .txt file

조회 수: 3 (최근 30일)
Venkatkumar M
Venkatkumar M 2021년 1월 14일
댓글: Image Analyst 2021년 1월 15일
hello,
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?
z=readmatrix("t2.txt");
y=z(:,1);
x=z(:,2);
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

채택된 답변

Image Analyst
Image Analyst 2021년 1월 14일
편집: Image Analyst 2021년 1월 14일
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);
  댓글 수: 2
Venkatkumar M
Venkatkumar M 2021년 1월 15일
편집: Venkatkumar M 2021년 1월 15일
Image Analyst
Image Analyst 2021년 1월 15일
If you have trouble with the answers already provided there, then say so and show why.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by