Be the first to rate this file! 110 downloads (last 30 days) File Size: 8.36 KB File ID: #25406

Fortran mex routine mxGetClassName

by James Tursa

 

25 Sep 2009

Code covered by BSD License  

A drop-in replacement for the TMW Fortran API function mxGetClassName routine that does not work.

Download Now | Watch this File

File Information
Description

The Mathworks supplied mxGetClassName routine for Fortran does not work. This routine is a drop-in replacement. The following syntax and description is similar to The Mathworks documentation, except that this drop-in replacement routine returns a fixed 128 length character string. This routine only works for mex routines, since it relies on the mexCallMATLAB function. Thus, it will not work for engine applications.

IMPORTANT: Be sure to use my supplied version of the mxCopyPtrToCharacter routine, since the MATLAB supplied version in their API does not work. My version is listed at the end of the posted file.

Fortran Syntax

       character*128 function mxGetClassName(pm)
       mwPointer, intent(in) :: pm

Requires

   #include "fintrf.h"

Arguments

 pm

   Pointer to any mxArray variable.

Description

Call mxGetClassName to determine the class of an mxArray. The class of an mxArray identifies the kind of data the mxArray is holding. For example, if pm points to a logical mxArray, then mxGetClassName returns logical.

This drop-in replacement routine fills the trailing part of the return string with blanks.

In addition to the routine itself, I have included a test driver routine, test_mxGetClassName.f and an associated file test_mxGetClassName.m. After running mex -setup and selecting a Fortran compiler, simply issue the command test_mxGetClassName(variable) and the mex function will self-build and then execute.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements A Fortran compiler.
Zip File Content  
Other Files license.txt,
mxGetClassName.ZIP
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
mex James Tursa 25 Sep 2009 12:07:47
mxgetclassname James Tursa 25 Sep 2009 12:07:47
fortran James Tursa 25 Sep 2009 12:07:47
class name James Tursa 25 Sep 2009 12:07:47
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com