フィルターのクリア

size gives contradictory results

2 ビュー (過去 30 日間)
Miguel Garcia
Miguel Garcia 2016 年 2 月 18 日
コメント済み: Miguel Garcia 2016 年 2 月 18 日
Dear all,
I have a vector called "centers" which should be 1x26. When I call "whos centers" I obtain:
>> whos centers
Name Size Bytes Class Attributes
centers 1x26 208 double
Which makes sense. When I type "centers" the whole vector is displayed, and its size is 1x26. When I call "size(centers, 2)" I obtain 26, which also makes sense. However, when I call "size centers" I obtain:
>> size centers
ans =
1 7
Also, when I type "length centers" I obtain:
>> length centers
ans =
7
Does anybody understand what is happening here? I am quite puzzled.
Thank you very much,
Miguel

採用された回答

MHN
MHN 2016 年 2 月 18 日
編集済み: MHN 2016 年 2 月 18 日
If you want the size of your vector you should use the following comment:
size(centers)
"size centers" shows the size of word "centers"! Also the same for the "length". size(centers, 2) returns the size of second dimension (26). size(centers, 1) returns the size of the first dimension (1).
  1 件のコメント
Miguel Garcia
Miguel Garcia 2016 年 2 月 18 日
You are right, "size(centers)" gives 1x26 and "size size" gives 1x4.
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by