visual3d:documentation:third-party:matlab:matlab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:third-party:matlab:matlab [2025/09/03 20:24] – wikisysop | visual3d:documentation:third-party:matlab:matlab [2025/09/18 15:22] (current) – [Examples] wikisysop | ||
---|---|---|---|
Line 44: | Line 44: | ||
**The text file must have a .txt extension and the same name as the .dll it describes. An example would be:** | **The text file must have a .txt extension and the same name as the .dll it describes. An example would be:** | ||
- | |||
- | $ ls MathLab-Plugins # (or ' | ||
swindowlib.dll | swindowlib.dll | ||
swindowlib.txt | swindowlib.txt | ||
\\ | \\ | ||
- | |||
- | $ cat swindowlib.txt | ||
- | swindow | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ; | ||
**This tells Visual3D that swindowlib.dll has an entry point named swindo that takes 4 parameters: | **This tells Visual3D that swindowlib.dll has an entry point named swindo that takes 4 parameters: | ||
Line 269: | Line 259: | ||
*[[visual3d: | *[[visual3d: | ||
*[[visual3d: | *[[visual3d: | ||
- | + | *[[visual3d: | |
- | + | ||
- | === Eval_In_Matlab | + | |
- | + | ||
- | Causes a concurrent version of Matlab to execute the specified Matlab function. | + | |
Line 291: | Line 277: | ||
This sample code [[Visual3D: | This sample code [[Visual3D: | ||
- | === Exporting signals to a Matlab .mat file === | ||
- | |||
- | A useful function of the Visual 3D scripting language is its ability to communicate with Matlab, a programming language specifically designed for technical computing. | ||
- | |||
- | Data can be exported from Visual 3D to a MAT file by using the **Export_Data_To_Matfile** command. This command allows you to save signal data and parameter data from Visual 3D into MAT format so it can be read by a Matlab function. You must specify the file name of the file from which the data is to be taken, the signal name, the signal type, whether or not the signal is processed or not, and the output name. The output name is simply the name of the variable that is saved in the MAT file; this is not necessarily the same as the signal name (see below). In addition to this, if you want to export parameters (data from the PARAMETERS branch of the data tree), you can include the **PARAMETER_GROUPS, | ||
- | |||
- | As an example, Visual3D will export data to Matlab (.mat) files using the following pipeline command syntax. This example was derived using the ExampleWalk.c3d file available on the website. | ||
- | |||
- | Export_Data_To_Matfile | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ! / | ||
- | ! / | ||
- | ! / | ||
- | ; | ||
- | |||
- | Note that Matlab 7.0 Release 14 is incompatible with Release 12 and 13; Visual3D currently import/ | ||
=== Matlab Cell Array === | === Matlab Cell Array === | ||
Line 316: | Line 282: | ||
Visual3D exports signals to a mat file as [[https:// | Visual3D exports signals to a mat file as [[https:// | ||
- | For example, the following command:// | + | For example, the following command: |
+ | < | ||
Export_Data_To_Matfile | Export_Data_To_Matfile | ||
/ | / | ||
Line 328: | Line 294: | ||
! / | ! / | ||
; | ; | ||
- | + | </ | |
- | places | + | Places |
RANK contains the contents of the signal RANKLE_ANGLE// | RANK contains the contents of the signal RANKLE_ANGLE// | ||
Line 350: | Line 316: | ||
Data can be imported to Visual3D using a syntax similar to export.// | Data can be imported to Visual3D using a syntax similar to export.// | ||
+ | < | ||
Import_Data_From_Matfile | Import_Data_From_Matfile | ||
FILE_NAME=**c: | FILE_NAME=**c: | ||
Line 358: | Line 324: | ||
INPUT_NAMES=**RFT1+RFT2+RFT3+FZ2+EMG9 | INPUT_NAMES=**RFT1+RFT2+RFT3+FZ2+EMG9 | ||
; | ; | ||
- | | + | </ |
=== Format of the mat file for Visual3D === | === Format of the mat file for Visual3D === | ||
- | The format of the matfile is specific to Visual3D. The following example demonstrates a simple use of the mat file that reveals the particular syntax expected by Visual3D. | + | The format of the matfile is specific to Visual3D. The following example demonstrates a simple use of the mat file that reveals the particular syntax expected by Visual3D.// |
+ | Edit average_3targets_return_target.m and add the following code:// | ||
< | < | ||
- | ! --------------------------------------------------------------------- | ||
- | ! The example m-file is listed here. | ||
- | ! To compile the m-file | ||
- | ! Switch to dos (Command Prompt) | ||
- | ! Change to directory containing the m-file | ||
- | ! To create the executable | ||
- | ! mcc -p average_3targets_return_target | ||
- | ! | ||
- | ! edit average_3targets_return_target.m | ||
- | ! and add the following code | ||
- | ! --------------------------------------------------------------------- | ||
function testmfile | function testmfile | ||
% load the file that was written out by C-Motion Visual3D | % load the file that was written out by C-Motion Visual3D |
visual3d/documentation/third-party/matlab/matlab.1756931081.txt.gz · Last modified: 2025/09/03 20:24 by wikisysop