필터 지우기
필터 지우기

How to create a pointer on a struct?

조회 수: 5 (최근 30일)
Andreas Schwager
Andreas Schwager 2017년 2월 21일
답변: Philip Borghesani 2017년 2월 21일
Hi,
reading the Documentation from libstruct, there is following example:
double addStructFields(c_struct) sm.p1 = 476; sm.p2 = -299; sm.p3 = 1000; sc = libstruct('c_struct',sm)
Executing these lines on my Matlab there is following error Message:
Error using feval Undefined function 'lib.c_struct' for input arguments of type 'struct'.
Error in libstruct (line 16) ptr=feval(['lib.' structtype],initialvalue);
Why ? How to fix?
Thanks

답변 (1개)

Philip Borghesani
Philip Borghesani 2017년 2월 21일
MATLAB does not know what a c_struct is without loading the library. Load the library first using the code from the example:
if not(libisloaded('shrlibsample'))
addpath(fullfile(matlabroot,'extern','examples','shrlib'))
loadlibrary('shrlibsample')
end

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by