Afficher commentaires plus anciens
例えばA=[1,1,1,1,5, 2,2,2,2,3, 4,4,1]といった13×1の変数があるとします。
これらを上から順に5行毎に分けその最頻値を取りたいです。今回の場合はB=[1, 2, 4]といった感じで、最後は割り切れないがそのまま出力したいと思っています。
mode関数がよいようなのですが、以下のようにプログラムして上手くいきません。ご教授いただけると幸いです。よろしくお願いいたします。
for i = 1:length(A):5
k=i+4;
l=mode(A(i:k,:),2);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 整数論 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!