help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vector Shape


From: John W. Eaton
Subject: Vector Shape
Date: Fri, 30 Apr 2010 10:05:26 -0400

On 30-Apr-2010, Paul Keir wrote:

| Hi,
| 
| I'm just curious, why is the length of the dimension vector of a one 
dimensional array (Array.h) two, instead of one?
| 
| e.g.
| 
| Array<int> foo(7);
| std::cout << foo.dims().str() << std::endl;
| std::cout << foo.is_vector() << std::endl;
| 
| displays:
| 
| 7x1
| 1
| 
| I would have thought I'd get:
| 
| 7
| 1

Because the Array class in liboctave was designed specifically for
implementing the Octave language, which, like Matlab does not have
arrays with only one dimension.  Every array object has at least two
dimensions.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]