help-octave
[Top][All Lists]
Advanced

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

extending arrays


From: John W. Eaton
Subject: extending arrays
Date: Fri, 28 Feb 1997 22:54:23 -0600

On 28-Feb-1997, Dave Comer <address@hidden> wrote:

| Can anyone tell me the Octave quivalen of the following (valid)
| Matlab statement:
| 
| dydx = [ 1, dydx ];
| 
| dydx is a 120 x 1 element array. The idea is to add one element to
| the array. When I execute this in octave I get the following:
| 
| octave:29> size(dydx)
| ans =
| 
|   120    1
| 
| octave:30> dydx = [1, dydx];
| error: number of rows must match near line 30, column 12
| error: evaluating assignment expression near line 30, column 6

Are you sure this is valid in MATLAB?  With 4.2c, I get:

  >> a = [1;2] 

  a =

       1
       2

  >> [0,a]
  ???  All matrices on a row in the bracketed expression must have the 
   same number of rows.

  >> [0;a]

  ans =

       0
       1
       2

This also works for Octave.

jwe


reply via email to

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