フィルターのクリア

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);
  1 件のコメント
Pravin Narola
Pravin Narola 2019 年 7 月 19 日
Thank you!worked perfectly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by