help-octave
[Top][All Lists]
Advanced

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

Re: Cannot compile .oct function which calls another .oct function


From: Kai Torben Ohlhus
Subject: Re: Cannot compile .oct function which calls another .oct function
Date: Tue, 30 Jul 2013 16:10:23 +0200

On 30 July 2013 04:14, babelproofreader <address@hidden> wrote:
I have successfully compiled a .oct function called
"reshape_column_to_matrix," which is essentially my compiled version of the
Octave reshape command. I now want to call this function from another .oct
function named "oct_from_oct" using:

octave_value_list tmp_ret = Freshape_column_to_matrix( A , no_of_rows ,
no_of_cols ) ;

but I'm getting the following error:

octave:1> cd ~/Documents/octave/oct_file_exp
octave:2> mkoctfile oct_from_oct.cc
oct_from_oct.cc:4:43: fatal error: octave/reshape_column_to_matrix: No such
file or directory
compilation terminated.
octave:3>

The "reshape_column_to_matrix" function and the "oct_from_oct" function are
both in the ~/Documents/octave/oct_file_exp directory. What am I doing
wrong?

You can use feval to call your function in "oct_from_oct.cc" here some minimal example:

#include <octave/oct.h>
#include <octave/parse.h>

DEFUN_DLD (oct_from_oct, args, nargout, "Nice documentation.")
{
  octave_value_list retval;

  NDArray A = args (0).array_value ();
  int no_of_rows = A.cols ();
  int no_of_cols = A.rows ();

  octave_value_list new_args;
  new_args (0) = A;
  new_args (1) = no_of_cols;
  new_args (2) = no_of_rows;
  octave_value_list tmp_ret = feval ("reshape_column_to_matrix", new_args, 0);

  retval = tmp_ret;

  return retval;

Best,

Kai

reply via email to

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