How do I create a new array that is a cropped version of another array?

6 ビュー (過去 30 日間)
Aoife Monahan
Aoife Monahan 2016 年 5 月 4 日
コメント済み: CS Researcher 2016 年 5 月 4 日
I am using a txt file to hold data on an ultrasound signal but I want it so that only a certain section of the data is placed as a different name. I want the user to pick the max and min time axis that holds a peak of interest and do analysis on the cropped signal which would involve moving the data to a different variable name. How do I go about doing this? Example: I have data that goes from to 10 micrometers but I only want the data that is between 4.7 and 5.2 micrometers for peak analysis.

回答 (1 件)

CS Researcher
CS Researcher 2016 年 5 月 4 日
編集済み: CS Researcher 2016 年 5 月 4 日
Let us say the vector which contains all the values is t. You can do this:
startLocation = find(t >= 4.7,1);
endLocation = find(t >= 5.2,1);
croppedVector = t(startLocation : endLocation);
This of course assumes that all the values in the vector t are sorted in ascending order. Hope this helps!
  2 件のコメント
Aoife Monahan
Aoife Monahan 2016 年 5 月 4 日
Thanks for answering. This is giving me the time values from the specified limits but not the corresponding amplitudes associated with the time values.
CS Researcher
CS Researcher 2016 年 5 月 4 日
Do this:
croppedVector = originalVector(startLocation : endLocation);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by