# How can I select all parts of a vector?

1 回表示 (過去 30 日間)
giancarlo maldonado cardenas 2022 年 5 月 11 日
hello everyone, I have a problem with my code that I cannot solve, I have a vector of 1536, what I am trying to do is select a part for each iteration for, that is, basically I divide that vector of 1536 into 64 parts of 24, and in each part of those 24 I try to discover the peak that crosses a threshold, the problem is that I only get to point 1512 of the 1536 and there is a last peak that crosses the threshold at point 1520 as shown in the image, can someone help me please?
attached bin2.mat and pdp.mat

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

### 回答 (1 件)

Mitch Lautigar 2022 年 5 月 11 日
Remove the -1 from your for loop.
for ci = 1:numel(bins)-1
##### 9 件のコメント7 件の古いコメントを表示7 件の古いコメントを非表示
dpb 2022 年 5 月 11 日

Wherever you find the index inside the binned subset, the overall index to the original array is simply that index plus the starting bin index.
For example, in
[M,I] = max(data);
I will be the location of the maximum in the subsection counting from 1; so the same value/location in the orginal vector will be the location
Ibig=i1+I-1;
Isn't that pretty self-evident since you're beginning each data segment at postion i1 in the full vector?
giancarlo maldonado cardenas 2022 年 5 月 13 日
the code continued without finding the last one, but I modified a line and it worked perfectly, how can I accept your question? you answered another user's question hehe

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

### カテゴリ

Help Center および File ExchangeLTE Toolbox についてさらに検索

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by