countmember

バージョン 2.1 (1.87 KB) 作成者: Jos (10584)
Count members.

ダウンロード 6.2K 件

更新 2019/1/20

ライセンスの表示

編集メモ: This file was selected as MATLAB Central Pick of the Week

C = COUNTMEMBER(A,B) counts the number of times the elements of array A are present in array B, so that C(k) equals the number of occurences of A(k) in B. A may contain non-unique elements. C will have the same size as A.
A and B should be of the same type, and can be cell array of strings.

Examples:
countmember([1 2 1 3],[1 2 2 2 2])
-> 1 4 1 0
countmember({'a','b','c'},{'a','x','a'})
-> 2 0 0

引用

Jos (10584) (2022). countmember (https://www.mathworks.com/matlabcentral/fileexchange/7738-countmember), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2018b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!