Setting Take Name via Matlab

NatNet, VRPN, TrackD, and Plugins
Post Reply
c.s.chapman
Posts: 5
Joined: Wed May 25, 2011 3:10 pm

Setting Take Name via Matlab

Post by c.s.chapman »

I've got a successful communication between Matlab and Motive and can send and receive all messages except the TakeName command.

I have tried:

theClient.SendMessageAndWait('TakeName','Take1') [gives error for wrong method format]
theClient.SendMessageAndWait('TakeName,Take1') [does nothing]
theClient.SendMessageAndWait('TakeName Take1') [does nothing]

I guess my question is, how do you pass the string specifying the specific name?

Thanks,

Craig
nle2
Posts: 2
Joined: Wed Jul 09, 2014 1:27 pm
Location: New Jersey Institute of Technology

Re: Setting Take Name via Matlab

Post by nle2 »

I had the same problem a few months ago.

After contacting NaturalPoint support I found that the following works in MATLAB R2013b with NatNet2.5:

[byteArray, retCode] = theClient.SendMessageAndWait('SetRecordTakeName,Test3');

The issue is that the command string Motive is expecting is SetRecordTakeName, and not TakeName as the documentation seems to imply.

If its of any help, I use the following code to set my take names and MATLAB data filenames to match for every recording:

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GET & FORMAT DATE & TIME FOR FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

DaT = clock; % Current Date & Time

% Format hours to two digits if one digit.
if length(char(num2str(DaT(4)))) == 1
    hours = char(['0',num2str(DaT(4))]);
else
    hours = char(num2str(DaT(4)));
end

% Format minutes to two digits if one digit.
if length(char(num2str(DaT(5)))) == 1
    minutes = char(['0',num2str(DaT(5))]);
else
    minutes = char(num2str(DaT(5)));
end

% Format nearest integer of seconds to two digits if one digit.
if length(char(num2str(fix(DaT(6))))) == 1
    seconds = char(['0',num2str(fix(DaT(6)))]);
else
    seconds = char(num2str(fix(DaT(6))));
end

% Assemble current date & time string.
DaTchar = char([num2str(DaT(1)),'-',num2str(DaT(2)),'-',num2str(DaT(3)),'-',hours,'.',minutes,'.',seconds]); 

% Create filename
filename = char(['EGG_MIC_SyncOut_data_',DaTchar,'.txt']);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET TAKE FILENAME IN MOTIVE & START RECORDING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

NatNetCommandandFilename = char(['SetRecordTakeName,',DaTchar]);
[byteArray,retCodeName] = theClient.SendMessageAndWait(NatNetCommandandFilename); % Set Take Name in Motive via NatNet
Post Reply