TrueTime installation, operation routines

I. Introduction

  Truetime installation is to complete the course-related needs, but encountered some problems during the installation process, think of yourself before registering the blog so I plan to put this as the first chapter of the content. Please be assured that the installation process is not difficult, safe to eat.

Second, prepare

  1. Truetime 2.0    http://www.control.lth.se/research/tools-and-software/truetime/
  2. matlab             (version >= 7.0)
  3. visual studio 

Note: Visual Studio version requires the use of Matlab supported versions, you can ( https://ww2.mathworks.cn/support/requirements/previous-releases.html view your Matlab version supports) the c / c ++ compiler version, then download can be installed, note truetime only use visual studio compiler .

For example, my matlab version is 2015b, click on the corresponding link under the Support Compilers, found in the pdf under "For MEXfile ..." entry has a check mark is supported by the compiler:

We can see Matlab2015b supported versions between the VS2015-VC2008. 

Third, the installation process

Matlab is assumed that the installation path $ {MATLABPATH} (eg: C: \ Program Files \ MATLAB \ R2015b), if this can be for convenience as environment variables

Step1 : the TrueTime archive into the toolbox matlab installation package file in the folder, namely $ {MATLABPATH} \ toolbox in

Step2 : add environmental variables TTKERNEL, a value of $ {MATLABPATH} \ toolbox \ truetime -2.0 \ kernel ( Note: If the variable is not set, if desired, MATLABPATH absolute path)

     If the variable is set to the variables you need to restart the computer user, if the system is used directly for the variables

Step3 : Administrator way to open Matlab, Matlab will be added to the path TrueTime

Add the path:

${MATLABPATH}\toolbox\truetime-2.0\kernel
${MATLABPATH}\toolbox\truetime-2.0\kernel\matlab
${MATLABPATH}\toolbox\truetime-2.0\kernel\matlab\help

Close to save, you can choose to add these three folders, of course, convenience can directly add and select Include subfolders.

 Step4 : Set Matlab path $ {MATLABPATH} \ toolbox \ local , open $ {MATLABPATH} \ toolbox \ local \ startupsav.m, is added and saved in the file header:

addpath(getenv('TTKERNEL'))
init_truetime;

(If you can not save with instructions not to open the administrator mode)

STEP5 : Open $ {MATLABPATH} \ toolbox \ local \ matlabrc.m, save for the use Save WorkSpace matlab.mat

Step6:将 ${MATLABPATH}\toolbox\truetime\kernel 文件夹下的init_truetime.m文件拷到matlab安装目录下的toolbox下local文件夹中,注意是kernel文件夹下的init_truetime.m,然后在复制的init_truetime.m末尾添加代码

addpath(getenv('TTKERNEL')) 

Step7:在matlab命令行输入下面,选择自己的编译器

mex -setup c++

我的结果如下所示,直接点击即可或输入提示命令,显示配置完成即可。

Step8:执行编译脚本开始编译

make_truetime

最终得到Successful证明你成功了,可以直接到第五部分执行例程

如果不那么幸运的话我们会得到这样的结果 Compilation using MEX failed! (Run ''mex -setup C++'' to configure your C++ compiler)

我们可以这样做,首先在matlab命令行输入:

open make_truetime

在脚本中我们用‘%’注释掉异常处理代码try...catch...end,保存后再次执行make_truetime,就会显示运行中出现的真实错误,根据提示处理问题。

 四、处理问题

1. 找不到stdin.h,找不到UINT32_C

  将 ${MATLABPATH}\toolbox\truetime-2.0\kernel\include_msc 中的.h文件复制到 ${MATLABPATH}\extern\include,我们打开复制过去的stdint.h,找到INT32_C,然后将它的宏条件注释掉:

2. 找不到make_truetime

  没能把truetime的路径添加到matlab中

3. 路径错误

  环境变量TTKERNEL配置出错

4. 找不到SDK

  没有安装matlab相应版本的visual studio

5. 无法打开XXX.mexw64

  编译过程中出错,可以删除truetime文件夹,然后将新的truetime文件夹放到toolbox中

......其他问题可以留言学习

五、执行例程

设置matlab路径为truetime下的example中选择的例程路径,打开模型文件然后运行测试即可。

六、总结

  本来打算随便写一点,结果发现自己对很多步骤都遗忘了,看来以后做实验之类的还是需要用录屏方法记录,写这种文章可能没什么价值但是如果能够帮到你那是我的荣幸,仅此而已。

  如果有更好的方法或有问题,欢迎留言交流,祝好。

Guess you like

Origin www.cnblogs.com/oneflyleader/p/12079189.html