Splitting a signal Vec into two independent signal array

2 visualizaciones (últimos 30 días)
@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,

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Sept. de 2021
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);

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by