help-octave
[Top][All Lists]
Advanced

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

Reshape


From: Paul Keir
Subject: Reshape
Date: Wed, 28 Apr 2010 17:29:33 +0100

Hi,

I'm using Octave 3.2.4 under cygwin, and am interested in using the Octave C++ 
libraries. I'm using the reshape function on a 2x3 array, but can't see the 
effect. My code is:

int main(int argc, char *argv[])
{
  Array2<double> a(2,3);

  for (int i = 0; i < a.dims().length(); i++)
    std::cout << a.dims()(i) << " ";
  std::cout << std::endl;

  dim_vector new_shape(1,6);
  a.reshape(new_shape);

  for (int i = 0; i < a.dims().length(); i++)
    std::cout << a.dims()(i) << " ";
  std::cout << std::endl;

  return 0;
}

And the output is:
2 3
2 3

Am I using reshape wrongly?

Regards,
Paul

The University of Glasgow, charity number SC004401



reply via email to

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