separating the data, peaks and troughs, NaN

1 回表示 (過去 30 日間)
Borhan
Borhan 2013 年 11 月 30 日
コメント済み: Image Analyst 2013 年 11 月 30 日
I had bunch of data from a cyclic load on mice bone. The data is, thus, fluctuating with an overall downward trend. I managed to find the peaks and troughs of these data at each cycle, putting them in a vector, while the rest of the data is assigned 0 or NaN. Now, I need to separate them in two vectors: i.e vector peaks and trough peaks. I was wondering if any could help me in this respect. Any guideline is highly appreciated. Here is the sample point of 100 data: NaN NaN NaN NaN NaN NaN NaN NaN -4.6943 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.3718 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.7253 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.4214 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.7377 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.4400 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN -4.7501 NaN NaN Thanks

回答 (1 件)

Image Analyst
Image Analyst 2013 年 11 月 30 日
You mean like this:
m2 = m(~isnan(m)) % Pull out non-nan values.
  2 件のコメント
Image Analyst
Image Analyst 2013 年 11 月 30 日
Borhan's "Answer" moved here because it was really a comment to me rather than an answer to his original question:
Thank you very much for your prompt reply. actually I have 3 columns of data (time, displacement, force) and I want to detect peaks and troughs of these data as well as their coincident time. What you mentioned just spits out the extremums (peaks and troughs) while I want to have these data separately (including their index). Thanks again for your reply.
Image Analyst
Image Analyst 2013 年 11 月 30 日
The indexes of your array (that long array that you got somehow) that are non nans is given by
nonNanIndexes = find(~isnan(m));

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

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by