using .m scripts in C++ programs

Carlo de Falco carlo.defalco at gmail.com
Thu Apr 10 04:16:47 CDT 2008


On 09/apr/08, at 22:08, Ken Massey wrote:
> How can I use existing .m scripts in my C++ code?  e.g. the one to
> find the rank of a matrix:
>
>   http://velveeta.che.wisc.edu/cgi-bin/cvsweb.cgi/~checkout~/octave/ 
> scripts/linear-algebra/rank.m?rev=HEAD&content-type=text/plain
>
> Do these .m scripts have compiled versions I can link into my C++  
> program?
>
>
> #include <octave/oct.h>
> int main (void) {
>        int n = 2;
>        Matrix A = Matrix (n, n);
>       A(1,1)=1;  A(1,2) =2;
>       A(2,1)=2;  A(2,2) = 4;
>
>      // how can I do something like this?
>        std::cout << rank(A);
>               //  or
>        std::cout << A.rank();
> }
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www.cae.wisc.edu/mailman/listinfo/help-octave

You can use feval.
See for example this thread for more information:
https://www.cae.wisc.edu/pipermail/help-octave/2008-April/008712.html
c.



More information about the Help-octave mailing list