Splitting a signal Vec into two independent signal array

2 次查看(过去 30 天)
@Stephen hello, Can I read a signal in Time domain, only inside a Time? It means, I have a signal (vector), but, Im interesting only to know what happen inside a period of this time. How can I read (or create a new vector) with values only that time which I wish? attached you can find the .mat and inside if you plot the variables (sweep_time,power_array, you can see which signal i would like to check. Should be nice I can create a new "sweepTime" and "power_array" with same dimensions and the time fit only inside the period which i really want. Thanks for the support,

采纳的回答

Walter Roberson
Walter Roberson 2021-9-1
Can I read a signal in Time domain, only inside a Time?
Not from a .mat file, NO.
For some other kinds of data files, it is sometimes possible to jump around within the file to locate the boundaries of where the times match, and then to extract only that section. This is pretty much restricted to binary files with fixed record sizes, and the search field (sweep_time) would have to be known to be sorted.
For all other file organizations, the best you can sometimes do is to read from the beginning and stop reading when you recognize that you have exceeded the last target time. But you cannot do that with .mat files or with .xlsx files; you can sometimes do it with text files such as csv files.
So... what you do instead, is to read the entire file, the way you already do, and then to extract a subset of it that matches the time range you want.
TT = table(sweep_time(:), power_array(:), 'VariableNames', {'sweep_time', 'power_array'});
mask = TT.sweep_time >= FirstTime & TT.sweep_time <= LastTime;
extract = TT(mask,:);
plot(extract.sweep_time, extract.power_array);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by