필터 지우기
필터 지우기

What might cause a segmentation fault calling matGetVariable

조회 수: 3 (최근 30일)
Campbell
Campbell 2016년 2월 5일
댓글: Jan 2016년 2월 5일
I have a Matlab script which saves several parameters and a data array to a *.mat file. I then run a program compiled from c and c++ code using gcc (vs. 4.6.1). It reads the variables from the mat file, using the functions in mat.c. Several variables are read correctly, but it fails on some 2D arrays, with a segmentation fault. (Some 2D arrays, in a different file are read correctly.) I have traced the calling sequence to getMatVariable, and the calling stack from this library object ("no source available" to the debugger), ends with
_int_malloc() at 0x31fa67a258
malloc() at 0x31fa67ab1c
H5FL_reg_malloc() at 0x7ffff1f3ad1e
The behavior is the same with Matlab versions R2014b and R2015b.
Please advise, With thanks, Campbell
  댓글 수: 2
James Tursa
James Tursa 2016년 2월 5일
I assume you mean matGetVariable. How large is the variable? Do you have enough memory to load it? Is the function returning a NULL pointer?
Jan
Jan 2016년 2월 5일
Please post the relevant part of the code. Most likely it contains a bug.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by