Splitting a signal Vec into two independent signal array

2 ビュー (過去 30 日間)
Antonio Carvalho
Antonio Carvalho 2021 年 9 月 1 日
回答済み: Walter Roberson 2021 年 9 月 1 日
@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 Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by