From: Etienne on 23 Feb 2010 11:58 Hi Folks Does anybody have a Fortran example of how mxGetString is used? I have looked at the C-example, but this has not really helped with Fortran. Regards Etienne
From: James Tursa on 23 Feb 2010 13:55 "Etienne" <etienne.coetzee(a)airbus.com> wrote in message <hm11es$li5$1(a)fred.mathworks.com>... > Hi Folks > > Does anybody have a Fortran example of how mxGetString is used? I have looked at the C-example, but this has not really helped with Fortran. > > Regards > > Etienne Try this (pass in a char string variable): ! caution, untested #include "fintrf.h" mexFunction(nlhs, plhs, nrhs, prhs) !-ARG integer*4 nlhs, nrhs mwPointer plhs(*), prhs(*) !-FUN integer*4, external :: mxGetString integer*4, external :: mexPrintf !-LOC integer*4 k character*50 line mwSize :: strlen = 50 !----- line = ' ' k = mxGetString(prhs(1), line, strlen) k = mexPrintf("The string passed in was "//line//achar(10)) return end James Tursa
From: Etienne on 24 Feb 2010 03:11 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hm18a8$ik2$1(a)fred.mathworks.com>... > "Etienne" <etienne.coetzee(a)airbus.com> wrote in message <hm11es$li5$1(a)fred.mathworks.com>... > > Hi Folks > > > > Does anybody have a Fortran example of how mxGetString is used? I have looked at the C-example, but this has not really helped with Fortran. > > > > Regards > > > > Etienne > > Try this (pass in a char string variable): > > ! caution, untested > > #include "fintrf.h" > mexFunction(nlhs, plhs, nrhs, prhs) > !-ARG > integer*4 nlhs, nrhs > mwPointer plhs(*), prhs(*) > !-FUN > integer*4, external :: mxGetString > integer*4, external :: mexPrintf > !-LOC > integer*4 k > character*50 line > mwSize :: strlen = 50 > !----- > line = ' ' > k = mxGetString(prhs(1), line, strlen) > k = mexPrintf("The string passed in was "//line//achar(10)) > return > end > > James Tursa Thanks James
|
Pages: 1 Prev: Color individual bars of 3D bar bar3 Next: linking MBUILD.BAT to c files? |