[Insight-developers] How to read .Mat File using ITK + C++

kent williams norman-k-williams at uiowa.edu
Wed Dec 8 09:42:11 EST 2010


Actually there is, in fact an ITK based matlab transform reader in
Insight/Review, if reading Matlab matrix files is what you intend. In order
to use it you need to configure Insight with the following flags:

ITK_USE_REVIEW:BOOL=ON
ITK_USE_TRANSFORM_IO_FACTORIES:BOOL=ON

Then look at 
Insight/Testing/Code/Review/itkTransformFileReaderWriterTest.cxx for an
example of how to use it.

I can¹t really tell what it is you¹re trying to do. Where are you getting
mat.h? there is no such file in ITK 3.20.  Neither is there a  function
named matOpen.  

As for matOpen being an unresolved external, you must not have added the
library containing matOpen to programs link libraries.


On 12/8/10 5:31 AM, "Humayun Irshad" <humayun.irshad at gmail.com> wrote:

> Dear all,
> 
> My code from .mat file readingis here:
>  
> #include "mat.h"
> 
> int main(int argc, char **argv)
> {
>      MATFile *pmat;
>      mxArray *pa;
>      pmat = matOpen("1.mat", "r");
>      if (pmat == NULL) {
>           printf("Error opening file\n");
>           return(1);
>      }
>      return 0;
> }
> 
> when i compiled and build this code then following error come
> 
> error LNK2019: unresolved external symbol _matOpen referenced in function
> _main
> 
> Can any body help me who can i read .mat file in ITK + C++. please help me

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101208/bf197769/attachment.htm>


More information about the Insight-developers mailing list