フィルターのクリア

Determining if the length of an array is even or odd?

13 ビュー (過去 30 日間)
Joe
Joe 2013 年 4 月 7 日
How do i determine if the length of an array is even or odd? Is there a specific function that does this? I know length(A) gives you the length of an array, but for a function I am creating, whether the length of an array A is even or odd is a condition that must be satisfied for the function to compute its output.

採用された回答

Image Analyst
Image Analyst 2013 年 4 月 7 日
if rem(length(A), 2) == 1
% It's odd
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by