필터 지우기
필터 지우기

How to calculate the number of elements in a matrix?

조회 수: 33 (최근 30일)
Nicoleta
Nicoleta 2016년 1월 9일
댓글: Pravin Narola 2019년 7월 19일
e.g having this matrix: M=[ 1 2 3; 7 8 9] I want to return 6 which is the total number of elements I want some other method besides size(M,1)*size(M,2). Thx

채택된 답변

Image Analyst
Image Analyst 2016년 1월 9일
Use numel():
numberOfElements = numel(M);

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by