Borrar filtros
Borrar filtros

separating the data, peaks and troughs, NaN

1 visualización (últimos 30 días)
Borhan
Borhan el 30 de Nov. de 2013
Comentada: Image Analyst el 30 de Nov. de 2013
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

Respuestas (1)

Image Analyst
Image Analyst el 30 de Nov. de 2013
You mean like this:
m2 = m(~isnan(m)) % Pull out non-nan values.
  2 comentarios
Image Analyst
Image Analyst el 30 de Nov. de 2013
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 el 30 de Nov. de 2013
The indexes of your array (that long array that you got somehow) that are non nans is given by
nonNanIndexes = find(~isnan(m));

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by