Function numel_struct_field in mex_utils.f90 not working
New function (tensor_unpack_shape) has already been implemented for the same purpose in mex_utils.f90.
numel_struct_field fixed provisionally as follows (uncommented lines fix the issue):
function numel_struct_field(struct_pr, fieldname, struct_idx) result(n)
mwPointer, intent(in) :: struct_pr
character(len=*), intent(in) :: fieldname
mwIndex, intent(in), optional :: struct_idx
!mwSize :: n ! intent(out)
mwPointer :: n
mwPointer :: field_pr
! mwPointer :: mxGetDimensions
! mwSize :: mxGetNumberOfDimensions
! mwSize :: n_dims
! integer(kind=4), dimension(:), allocatable :: dims
mwPointer :: mxGetNumberOfElements
field_pr = get_field_pr(struct_pr, fieldname, struct_idx)
! n_dims = mxGetNumberOfDimensions(field_pr)
! allocate (dims(n_dims))
! call mxCopyPtrToInteger4(mxGetDimensions(field_pr), dims, n_dims)
! n = product(dims)
! deallocate (dims)
n = mxGetNumberOfElements(field_pr)
end function