필터 지우기
필터 지우기

Info

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

How do I count to occurences of a number in an unsanitized array

조회 수: 1 (최근 30일)
Joel Abrahams
Joel Abrahams 2017년 7월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
Say I have cell A, with values:
0
0
1
[0; 1; 0]
1
Now I want to count the occurences of 1 is this matrix, and [0; 1; 0] should be ignored.
However, when I do:
amount_correct = sum(A == 1);
I get an error as soon as it arrives at [0; 1; 0].
I however simply want it to give as output 0 and move on to the next element of the array till I get to the end.
The eventual output should be 2.

답변 (0개)

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by