MATLAB using new Discovery 1 (tips: Shell command, engineering working directory settings related)

Source: Internet
Author: User

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 *************************************************


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.