help-octave
[Top][All Lists]
Advanced

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

How to create a 3D matrix in an oct-file?


From: Fredrik Lingvall
Subject: How to create a 3D matrix in an oct-file?
Date: Tue, 12 Jan 2010 10:04:36 +0100

Hi all,

I have tried this:

printf("%d %d %d\n",NN, N_alpha,N_beta);

dim_vector dv (3);
printf("%d\n",dv.length());

dv(0) = NN;
dv(1) = N_alpha;
dv(2) = N_beta;

NDArray p_mat(dv);
p = p_mat.fortran_vec();

In an oct-file but it fails with:

20 11 11
2
octave: /usr/local/include/octave-3.2.3/octave/dim-vector.h:125: octave_idx_type& dim_vector::dim_vector_rep::elem(int): Assertion `i >= 0 && i < ndims' failed.
panic: Aborted -- stopping myself...
Aborted

Why is the length of the dim_vector only 2 when I set it to 3 in the constructor?

Regards,

/Fredrik



reply via email to

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