Hello Markus,
try following example:
% create FreeMASTER ActiveX object
fmstr = actxserver ('MCB.PCM');
% write 0x10 value into "var16" variable defined in FreeMASTER project
bSucc = fmstr.WriteVariable('var16inc', 16);
var16inc = 0;
bSucc = fmstr.ReadVariable('!var16inc'); %"!" immediate performs the command
if bSucc
var16inc = fmstr.LastVariable_vValue;
end
% show the value
var16inc;
% configure matlab to accept safe array as single dimension
feature('COM_SafeArraySingleDim', 1) ;
% write 4 bytes to memory 0x20. WriteMemory function expects SafeArray as input data
bSucc = fmstr.WriteMemory(32, 4, {11;22;33;44})
% reads 4 bytes from memory at address of var32inc variable
bSucc = fmstr.ReadMemory('var32inc', 4);
if bSucc
% reads data of last call the ReadMemory()function.
readMemResult = fmstr.LastMemory_data
end
% write to memory at pointer. The value of "var8" represents the pointer, 0x02 is offset.
% this is only demonstration !!Beware that wrong value of var8 may cause memory corruption!!
array = [11;22;33;44];
bSucc = fmstr.WriteUIntArray('valueof(var8) + 0x02', 4, 1, {array});
We are preparing FreeMASTER tool 1.3.16 where are included more examples in User Manual (javascript in html, VBA script in html and Excel and this matlab example)
Best Regards,
Jaroslav