BTK Matlab Wrapper  0.3dev.0
Matlab bindings for the Biomechanical ToolKit library (BTK)
FAQ

Table of contents


General

What is the license used by BTK in Matlab?

BTK use the generous open-source New BSD license. Yes, you can use BTK in commercial products. The complete text of the copyright follows.

/*
 * The Biomechanical ToolKit
 * Copyright (c) 2009-2013, Arnaud Barré
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *     * Redistributions of source code must retain the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *     * Neither the name(s) of the copyright holders nor the names
 *       of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written
 *       permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */ 

What is the path to add in Matlab to use BTK?

It depends of your OS and where you install BTK. From the folder which contains BTK, the path to add is: <folder_containing_BTK>/share/btk-x.y/Wrapping/Matlab/btk (where x and y correspond to the major and minor revision of BTK. For example: 0.1). You need only to add this path.

Why Matlab send me the error "Invalid MEX-file" when I use a BTK function?

This problem is related to the mechanism used by Matlab to validate a MEX files. Matlab supports only a descending compatibility but not an ascending compatibility. Which means, than if BTK is compiled with Matlab r2008b, you can use the MEX function with Matlab r2008b or greater, but it is impossible to use it with Matlab r2008a or sooner.

The other possibility if you are under Windows, is that you install a version of BTK which was not configured with the redistributable option (or you install the version for Windows 7 and you are under Windows XP or Vista). In this case, you need to install the 'Visual C++ Redistributable Package' related to the compiler used.

Help me! Matlab crashes when I use some BTK functions!

There are two known situations for this problem.

Why Matlab send the error "Out of Memory"? I have few variables in the workspace.

This problem is certainly due to the impossibly of Matlab to detect the quantity of memory reserved for a loaded acquisition. As you may open a large amount of acquisition files, all the memory is used and has not be yet freed as all the acquisition are again stored in the memory (even if you reuse the same variable each time!). Using the command clear all, every memory allocated for the acquisitions will be freed. Another way is to use the function btkDeleteAcquisition which is like a close function. Use it, when you don't need to use the opened acquisition. For examples

% acquisitionsFilename: Large list of filenames
for 1:length(acquisitionsFilename)
acq = btkReadAcquistion(acquisitionsFilename{i});
% ... All of your code processing the acquisition's data
btkDeleteAcquisition(acq);
end

Why BTK use MEX functions? I would like to tune the code!

The use of MEX functions instead of M-script functions is mainly due to the fact that BTK is a C++ toolbox. To reuse the code in Matlab, there is no other choice than using the MEX API. If you know another method available for Matlab 7.0.4 and greater, please let me know!

It misses an important function for me, can you implement it?

If it is possible, then yes! Send an email to the group http://groups.google.com/group/btk-users or use the issue tracker (http://code.google.com/p/b-tk/issues/list) and label your issue as an enhancement.

Behavior of BTK in Matlab

What are all these warnings when I read an acquisition file?

These messages are only here to explain you that something is wrong in you acquisition's file and BTK attempts to correct them. To disable them, check the Warnings identifier page.

Error when I try to set/remove a point/analog channel/event using its label?

This problem can occur when you have complex labels and you try to use the field's name extracting from one the given structure. As explained in the Field's name format in extracted structures, Matlab cannot manage all the characters for the field's name of a structure. To correct this problem, you can, for example, try to remove the desired point/analog channel/event by using its index. Or you can also modify the label to simplify it.

I saved in a MAT file the handle associated with an acquisition, but I cannot reuse-it in a new Matlab session. I have this message "Parameter is NULL. It does not represent a MEXObjectHandle object", why?

A handle is only a value which "point" to the memory allocated for the acquisition. So, trying to reuse this value in another Matlab session cannot gives you access to the acquisition's data as the memory was freed when you close the previous Matlab session. To re-use the content of an acquisition, you have to reload it in each new session.