Difference in matrix sizes

2 ビュー (過去 30 日間)
Dario
Dario 2014 年 7 月 29 日
編集済み: Andrew Reibold 2014 年 7 月 29 日
Why is the size in bytes for the two matrices different?
x = 1:2:10
y = [1:2:10]
whos x
whos y
The output shows that the two arrays have different sizes (24 bytes and 40 bytes).
x =
1 3 5 7 9
y =
1 3 5 7 9
Variables in the current scope:
Attr Name Size Bytes Class
==== ==== ==== ===== =====
x 1x5 24 double
Total is 5 elements using 24 bytes
Variables in the current scope:
Attr Name Size Bytes Class
==== ==== ==== ===== =====
y 1x5 40 double
Total is 5 elements using 40 bytes

回答 (1 件)

Andrew Reibold
Andrew Reibold 2014 年 7 月 29 日
編集済み: Andrew Reibold 2014 年 7 月 29 日
Clear your variables and try again and see if it still happens. Doesn't happen for me.
x = 1:2:10

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by