필터 지우기
필터 지우기

Determining length of values in cell

조회 수: 5 (최근 30일)
Katrina Anderson
Katrina Anderson 2019년 2월 5일
댓글: KSSV 2019년 2월 6일
Hi,
I have a single column cell with numbers between 1 - 5 (each allocated to a behaviour). This is used to plot a line graph so I can see what behaviour occured at each given time period. My question: Is there a way to extract features such as for Step it occurs when the behaviour "4" is represented on the line graph for greater than 700 data points. Is there a way I can do that?
And also determine how many times in the cell the behaviour changes. Not sure if this makes sense. Ask me to clarify otherwise.
Thanks
Katrina
  댓글 수: 2
TADA
TADA 2019년 2월 5일
can you share a small example to make it clearer?
Katrina Anderson
Katrina Anderson 2019년 2월 5일
편집: Katrina Anderson 2019년 2월 5일
thankyou!
I will attach a screenshot of a small part of the graph:
possible_threshes = {'Standing', 'WS', 'PG', 'Step', 'LD'};
thresh_vals = [1, 2, 3, 4, 5]
[tf, idx] = ismember(testmodel2(:,1), possible_threshes);
Behaviourcoded(tf, 1) = num2cell( thresh_vals( idx(tf) ) );
and thats how I got to that.
As you can see in the graph. Around the 8 - that is one step not two. Because there is a very short segment of '4'.
Hope that makes more sense?
Thankyou!!

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2019년 2월 5일
편집: KSSV 2019년 2월 5일
If A is your data...you can use logicals like ==, >, < etc..to find the locations. For example, if you want where 4 is present. If the data is in cell, you need to use flower braces: A{1} ....
idx = find(A==4) ;
  댓글 수: 2
Katrina Anderson
Katrina Anderson 2019년 2월 6일
so like this:
idx = find([Behaviourcoded{:}] == 4);
and how would I find the incidence of 4 appearing 700 data points or more consecutively. Is this possible?
Thankyou!
KSSV
KSSV 2019년 2월 6일
YOu can use diff and check....

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Classification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by