The length of 256x256 image

1 回表示 (過去 30 日間)
Vishnu K
Vishnu K 2019 年 8 月 7 日
コメント済み: Walter Roberson 2019 年 8 月 7 日
The length of 256x256 image is

回答 (1 件)

Star Strider
Star Strider 2019 年 8 月 7 日
256
There are severall ways of determining the various dimensions of an array in MATLAB, the size function being the most useful. The length function returns the largest dimension of an array, that may not be the dimension you are interested in. The numel funciton returns the number of elements in an array.
So use size, and resolve the ambiguities.
There are a number of other related functions linked in and at the end of the size documentation, so it would be best to explore them as well.
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 7 日
This is the effective code for how length is defined:
function L = length(SomeArray)
dimensions = size(SomeArray);
if any(dimensions) == 0
L = 0; %empty on ANY dimension replies length 0
else
L = max(dimensions); %otherwise it is the largest dimension
end
end

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by