필터 지우기
필터 지우기

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 CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by