Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28179 Discussions

error #6404: This name does not have a type, and must have an explicit type. [MATOPEN]


Hi all,

I am trying to use matOpen to open and read .mat file but I got this error. Anyone can help me? Here is my code:


    program reading
    implicit none
    integer i,j,mp
    real(8), allocatable :: b(:,:)
    character(40) :: text
    open(unit=10, file="D:\fortranmatlab\readmatfile\readmatfile\motion.txt.")
    do i=1,108001
        do j=1,6
            write(10,*) b(i,j)
        end do
    end do
    end program reading

0 Kudos
1 Reply
Black Belt

You have IMPLICIT NONE, and the name matOpen has not been declared. That is the reason for the message. The program that you showed does not use the variable mp anywhere else, so you could simply remove the matOpen statement. Your program does not make much sense, because it opens a Matlab .mat file for reading, and writes the uninitialized variable b to a text file without going through the Matlab API functions.

On the other hand, if you wish to actually read a Matlab .mat file, you need to consult the Matlab documentation regarding how to do that from Fortran. See the two examples matDemo1.f and matDemo2.f in the extern\examples directory.

0 Kudos