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

Source: Internet
Author: User

recently debugging a MATLAB-based program, in the occasional found a few more interesting tricks, to share with you ( probably is too rookie, did not involve this aspect, the generous house does not have the laughed at, has the help to you to please likes! )

1. Matlab language is an interpreted language (interpreter)

as I summarize the software architecture Data flow:interpreter/virtual Machine (Interpreter/VM), the specific architecture can be see the following blog:http://blog.csdn.net/ lg1259156776/article/details/46802107(explanatory language corresponds to a compiled language similar to C, C + + ...) , etc.)

It seems that the interpretation of the language, basically the operation of the command are similar, so I tried in matlab under the Linux Shell scripting language command line input, did not expect a lot of shell commands in MATLAB can also work, and even the format is not adjusted, such as: Cd.. /data/, ls command, the Use of Tab key command index and other functions , these operations command is very convenient for development.


2. MATLAB Engineering working directory settings

In fact, for the simple MATLAB project almost do not need a special engineering directory, directly to the corresponding. m file into the command window can be run.

But for more complex projects, even under different projects have shared files (functions), so that the single directory is a little thin. For example, in machine learning training, a common use of the algorithm and data in the corresponding directory placement, while training always load in, and some of the data below a lot of small directory, so that the load command is a bit bloated, The best way to do this is to include all of the subfolders in the folder under all the large folders directly through a command, which makes the project easier: The file organization separates the methods and data through different folders, and the project calls are similar to all the methods and data in the same directory. Can be called directly or load.

Long winded, this very important command is one sentence:

Addpath (Genpath (' E:\MatlabProject\MachineLearning '));

The implementation of the function is to add all the sub-folders under the Machinelearning to the project directory, to achieve a simple call.


3. MATLAB Precision Setting

It is very common to adjust the accuracy of MATLAB output data, can be easily implemented by the following commands:

Digits (20);% 20 digits valid, full set display accuracy

A=VPA (sqrt (2));% sets the precision for each operation involved



Keep track of ************************************************* at any time


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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

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.