[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does size() work?
From: |
Przemek Klosowski |
Subject: |
Re: How does size() work? |
Date: |
Tue, 19 Jun 2012 16:30:02 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 06/19/2012 04:04 PM, Jonathan Margoliash wrote:
CorrectionData = {"1977:3.7423:6.5548" "1978:6.7854:9.6075"};
disp(size(CorrectionData));
..
Why isn't correction data treated as a 1-dimensional cell array? And
> even if it's been treated as a 2-dimensional cell array, why is the
> row second? Thanks!
This just shows the roots of the Matlab language, where the primary
object was a 2D numerical array. There is no truly one-dimensional data
type: when you do x=[3 4] you get size(x) as 1 2, i.e. x is a 2D array
with one row and two columns--first index numbers rows, second--columns.
The cell array works the same way: you got a 1x2 cell array. If you
transposed the data:
CorrectionData = {"1977:3.7423:6.5548" "1978:6.7854:9.6075"}';
you would get size(CorrectionData) equal to 2 1.