(Topic III) 01 programs and programming processes - order structure

Sequence Structure

Select structure

Loop structure

matlab file extension is .m

Files can be executed directly on the command line window: script file

Function File: is the definition of a function can not be executed directly, but must function call to call it

Build file:

1. Create a button with the command: Home ---> New Script, so start matlab Editor

 2. Create a file with the edit command

>>edit test

This statement creates a file called test.m  

example

    Were the product of the establishment of script files and function files, find two matrices

 

Establish the function file f2.m

>>edit f2

Boot line function file

  

A and B are the input parameters is an output parameter C, the product demand function returns

The product of two matrices seek

Sequence Structure

Input data, 100 is assigned to the variable A

 

Output data

Program pause

If you omit the delay time, the program will pause until the user presses any key, the program will be performed

Forced termination of the run the program: ctrl + c

example

Golden point

 

program:

Entry

What are the coordinates of golden point c

Are the coordinates of the s

Output statement

 

 In the face of programming problems -----> + method design ideas

Guess you like

Origin www.cnblogs.com/fanglijiao/p/11105889.html