help-octave
[Top][All Lists]
Advanced

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

Re: Mex files oct.h and mxGetDimensions


From: Quentin Spencer
Subject: Re: Mex files oct.h and mxGetDimensions
Date: Tue, 22 Mar 2005 11:45:53 -0600
User-agent: Mozilla Thunderbird 1.0-5 (X11/20050308)

Carine Simon wrote:

Hi,

I've got some troubles trying to use some mex files. The first one is that if I
include oct.h file, it cannot compile as it doesn't find some files such as
cassert. In fact, I think this is because include files of octave are under
/usr/local/include whereas C and C++ ones are under /usr/include. But I don't
know how to precise where to find libraries.

Well, I can still compile one of my functions without the oct.h. But I can't use
it as it doesn't find mxGetDimensions.
To try to be a bit more clear, I send you below the function I've tested:
I think the fundamental problem here is that the code you are trying to compile is written for Matlab's C API, which is completely different than Octave's. In Octave, for example, you can get the dimensions of a matrix X using X.rows() and X.columns(). mxGetDimensions is Matlab's way of implementing this.

For more reading on how to write dynamically linked functions in C++ for Octave, I would suggest the document at: http://octave.sourceforge.net/coda/index.html

If you are writing new C++ code, you will need to learn Octave's functions for things like dimensions. If you are trying to compile code originally written for Matlab, you will need to rewrite portions of the code. In the code you attached, you have a wrapper function that interfaces to Matlab and a function that uses pretty much plain C as far as I can tell. To compile in Octave, you need to write a new wrapper function that interfaces to Octave, but the other function appears that it can remain as it is.



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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