how to make a matlab structure into a pointer

5 Ansichten (letzte 30 Tage)
Neil Hamilton
Neil Hamilton am 24 Mai 2019
I have a structure that I need to pass as a c type pointer to a library function, but when following the example from this help page https://uk.mathworks.com/help/matlab/ref/libstruct.html it comes up with an error Undefined function or variable 'lib.c_struct'.
So how would I go about creating the pointer I need?
This is the code I've been trying;
if ~libisloaded('shrlibsample')
addpath(fullfile(matlabroot,'extern','examples','shrlib'))
loadlibrary('shrlibsample')
end
sm.p1 = 0;
sm.p2 = 0;
sm.p3 = 0;
sm.p4 = 0;
sm.p5 = 0;
sm.p6 = 0;
sm.p7 = 0;
sc = libstruct('c_struct')

Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by