MATLAB Basic functions: Custom function, add block comment, timer trial

Source: Internet
Author: User

1. Custom Functions

Create a new M file in the M file inside the first line input function [X,Y]=PLL (X1,Y1,X2,Y2), here x1 x2 y1 y2 is the input value of your function, X Y is the output value, and then define the function you want to implement, such as: X = x1 + x2; y = y1 + y2; Then save this m file, note!! The name of the m file must be the name of the defined function, which is saved as pll.m otherwise it will go wrong. Then enter the PLL (1,2,3,4) in the MATLAB command window and see what you get? You can also create a separate m file, where you call the PLL () function.

2. Add a block comment

1) To select the content you want to annotate, and then select the tool menu "Text|comment", if you want to change the comment into a statement, also select the statement to be changed, and then use the mouse to select "Text|uncomment". The keyboard shortcut is "Ctrl+r". or select the content you want to annotate, right click on the mouse to select "Comment", if you want to change the comment into a statement, also select the statement to be changed, and then right-click the mouse to select "Uncomment" uncomment. Keyboard shortcut keys are "Ctrl+t".

2) method two using Matlab block annotation method

%{

You need to comment on several command lines that are not executed

%}

3) method Three adds a line in front of the comment segment:

If LOGICAL (0) adds a line after the comment segment: End is different from the first two methods, and this method actually does not execute the related statement through the logical judgment statement

Call of the 3.Matlab timer

MATLAB Basic functions: Custom function, add block comment, timer trial

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.