Matlab Basics - Variables and Statements

1. Variable part

1.1 Variable naming

1. It is similar to C naming rules, but it does not need to be declared or defined,
and it can be used immediately. 2. If one line cannot be written, you can use "..." to continue the line, otherwise the default sentence has been completed.

1.2 Variable Management

The difference between the variable
whos and who
is displayed in the command mode is that the whos display is more detailed

The save function uses the save method to
save the variables in the workspace as a mat file.
Format : save[file name][variable name][-append][-ascii]
The file name must be selected

data output

format
data output format control
Syntax : format format specifier
Note:
1. Only affects the data output format, not calculation and storage
2. The default output format is short format
String
operation 1. To find the ascii code of the string, use the following types:
double (str)
abs(str)
2. String manipulation
eval performs string manipulation

structure

1. Structure establishment
Structure name. Member name = any expression
2. Structure judgment
isstruct(S): Determine whether S is a structure
fieldnames(S): Check the member variable name of the S structure
isfield(S,'FIELDNAMES '): Determine whether FIELDNAMES is the member name of the structure S
getfield(S,'FIELDNAMES'): Get the content corresponding to the member name

unit

1. Establish
Use {} brackets to establish
a= {1,'str',[1,2,3]}
2. Use
a(m,n) to indicate output elements of m rows and n columns

help command

help name
doc name## title##

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325810975&siteId=291194637