Recently debugging a program based on Matlab, accidentally found a few more interesting skills, to share with you (very likely it is too rookie, not involved in this respect, generous home please do not laugh, to help you to a point of praise. )
1. The Matlab language is one kind of explanatory language (interpreter)
As I summarize the software architecture Data flow: Interpreter/virtual machine (Interpreter/virtual machine), the specific architecture can refer to the following posts: http://blog.csdn.net/lg1259156776/article/ details/46802107 (interpreted language corresponds to a compiled language similar to C, C + + ...). Wait
It seems that this type of interpretation of the language, basically the operation of the command are similar, so I tried to use the Linux Shell scripting language in the command line input, did not expect many shell commands in the MATLAB can also work, and even format without adjustment, such as: Cd.. /data/, ls command, the use of the TAB key for command indexing functions , these commands are still very convenient for the development.
2. Matlab Project working directory setting
In fact, for a simple MATLAB project requires little special Engineering directory, directly to the corresponding. m file dragged into the command window can be run.
But for more complex projects, even in different projects have shared files (functions), such a single directory is a bit thin. For example, in machine learning training, a commonly used in the algorithm and data to the corresponding directory placement, while training in the total load to come in, and some data below there are many small categories, so the load command to write a bit bloated, The best way to do this is to include a directory of all subfolders underneath all the big folders directly through a command. This is more convenient for the project setup: The file organization separates the methods and data through different folders, and the project call is similar to all the methods and data in the same directory. Can be called directly or load.
After so much chatter, this very important order is:
Addpath (Genpath (' E:\MatlabProject\MachineLearning '));
The implementation of the function is to add all the machinelearning under the project directory, to achieve a simple call.
3. MATLAB Precision Setting
Very common on the adjustment of MATLAB output data precision problem, you can use the following command convenient implementation:
Digits (20),% 20 digits, full set display accuracy
A=VPA (sqrt (2));% set precision for each operation involved
******************************************* at any time, record *************************************************