필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to count the values with a specific condition in different cells of an array?

조회 수: 1 (최근 30일)
Sherwin
Sherwin 2016년 10월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I have an array that consists of cells with different lengths. I need to count the number of values which has the absolute difference less than 6. For example in the attached image in the cells [2,20,3] and [4,1,15], 2 and 4, 2 and 1 and 20 and 15, 3 and 4, 3 and 1 has absolute difference less than 6, I need the number of them that is 5. Here in this example the lengths of cells are equal, but in the real case they may have different lengths. Would you please help me code this in MATLAB?
  댓글 수: 2
Jan
Jan 2016년 10월 20일
Please post the code, which creates the "array of cells with different lengths". Any suggestion requires the creation of the data at first and at least I am not sure, what this sentence mean.
Adam
Adam 2016년 10월 20일
Also you should always try to give an example that is as simple as possible yet that still encapsulates the most complex cases you are looking for a solution for. Showing an example where all are the same length is not a good idea if you want a solution for the case where all are different length. In this case the solution is quite likely the same, but it is good practice to post an example that accurately reflects your true problem.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by