当前位置:网站首页>Matlab learning and actual combat notes
Matlab learning and actual combat notes
2022-07-06 11:46:00 【@Little snail】
Brief notes
1、
str=‘ With a semicolon ; ending , Don't show this sentence ’;
str_show=‘ No semicolon ; ending , Then the current variable content is displayed ’
This is a MATLAB A feature of , If a sentence is semicolon ‘;’ ending , Then the corresponding content or running result of this statement will not be displayed in the command window , If there is no semicolon ‘;’ Will be displayed . Be careful >> Together with the flashing cursor, it indicates that the system is ready , Waiting for input .
2、
The above is a small example of command line development , Other noteworthy places are
In the command window Enter Key submit command execution ,Shift+Enter You can continue to enter commands .
Operator used ( Such as +、-、^ etc. ) It is common in various calculation programs .
You can type an expression directly ( Such as 1+2), In the calculation results ans It's English “answer” An abbreviation for , Its meaning is “ Arithmetic answer ”.ans yes Matlab A predefined variable of .
3、MATLAB Built in output function disp(X)
disp The function is MATLAB Built in output function , Directly calling it can output the results you want in the command window X. there X It can be all kinds of data , Including digital 、 character 、 Matrices and so on . This level only needs to output a string of characters , for instance , For example, in the creation of test.m Enter the following code in the file :
4、 Character type data is in English single quotation marks ’ ‘ To represent the ! Like in the example ’ Hello !’
5、 Percent sign % Notation , in other words % The following content does not participate in the execution of the program , It is only used as an explanation of the sentence
6、 Variable naming rule
Variable name 、 Function names are case sensitive . Such as myVar And myvar Two Different variables .
The first letter of the variable name Must be English letters .
Variable names can contain English letters 、 Underline and numbers .
Variable name You can't Include spaces 、 punctuation .
The variable name can contain at most 63 Characters (6.5 And later versions ).
7、MATLAB use “\” and ”/” respectively “ be demoted ” and “ Divide right ”. For scalars , There is no difference between the two . Have different effects on the matrix .
8、 Common functions
disp(X): Used to display variables X Value , And the variable name is not displayed X
num2str(A): Used to convert numbers A Convert to string , According to the structure of this function, it is easy to see its meaning “number to string”, Isn't it very interesting
in addition , There are many, many useful functions , I won't give you too much introduction here , The following levels will be introduced slowly .
input(): It is used for users to input data in the program , The specific usage is x = input(prompt) perhaps str = input(prompt,‘s’), The former means entering a value , The latter means entering a string . When the program runs to this place , In the command window , The user needs to input a data , End with enter , Then this data will be stored in x( If character input is used , Is stored in str), among ,prompt Indicates a hint , It's usually a string , And this string must have ( Can be an empty string "").
边栏推荐
- 解决安装Failed building wheel for pillow
- [Flink] cdh/cdp Flink on Yan log configuration
- {one week summary} take you into the ocean of JS knowledge
- Word排版(小計)
- [Bluebridge cup 2021 preliminary] weight weighing
- Nodejs connect mysql
- [BSidesCF_2020]Had_a_bad_day
- error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead
- [yarn] CDP cluster yarn configuration capacity scheduler batch allocation
- Double to int precision loss
猜你喜欢

Vs2019 desktop app quick start

AcWing 242. A simple integer problem (tree array + difference)

Redis面试题

Pytorch基础

Learning question 1:127.0.0.1 refused our visit

解决安装Failed building wheel for pillow

Integration test practice (1) theoretical basis
![[Blue Bridge Cup 2017 preliminary] grid division](/img/e9/e49556d0867840148a60ff4906f78e.png)
[Blue Bridge Cup 2017 preliminary] grid division

Face recognition_ recognition

MySQL and C language connection (vs2019 version)
随机推荐
[Bluebridge cup 2021 preliminary] weight weighing
L2-006 树的遍历 (25 分)
mysql实现读写分离
Codeforces Round #753 (Div. 3)
nodejs连接Mysql
4. Install and deploy spark (spark on Yan mode)
Common regular expression collation
天梯赛练习集题解LV1(all)
AcWing 1294.樱花 题解
快来走进JVM吧
AcWing 1298. Solution to Cao Chong's pig raising problem
encoderMapReduce 随手记
L2-004 这是二叉搜索树吗? (25 分)
Antlr4 uses keywords as identifiers
MySQL与c语言连接(vs2019版)
Software testing and quality learning notes 3 -- white box testing
【kerberos】深入理解kerberos票据生命周期
ES6 promise object
L2-007 家庭房产 (25 分)
How to configure flymcu (STM32 serial port download software) is shown in super detail