当前位置:网站首页>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 "").
边栏推荐
- 4、安装部署Spark(Spark on Yarn模式)
- Machine learning -- census data analysis
- Vs2019 desktop app quick start
- ES6 let and const commands
- Antlr4 uses keywords as identifiers
- About string immutability
- 【yarn】CDP集群 Yarn配置capacity调度器批量分配
- QT creator uses Valgrind code analysis tool
- In the era of DFI dividends, can TGP become a new benchmark for future DFI?
- 【CDH】CDH5.16 配置 yarn 任务集中分配设置不生效问题
猜你喜欢
Cookie setting three-day secret free login (run tutorial)
[yarn] CDP cluster yarn configuration capacity scheduler batch allocation
分布式節點免密登錄
Vs2019 desktop app quick start
Stage 4 MySQL database
UDS learning notes on fault codes (0x19 and 0x14 services)
Linux yum安装MySQL
How to configure flymcu (STM32 serial port download software) is shown in super detail
[蓝桥杯2017初赛]方格分割
Software I2C based on Hal Library
随机推荐
第4阶段 Mysql数据库
Connexion sans mot de passe du noeud distribué
Machine learning -- census data analysis
库函数--(持续更新)
Error connecting to MySQL database: 2059 - authentication plugin 'caching_ sha2_ The solution of 'password'
How to set up voice recognition on the computer with shortcut keys
Antlr4 uses keywords as identifiers
【presto】presto 参数配置优化
[Flink] Flink learning
Library function -- (continuous update)
Composition des mots (sous - total)
Nanny level problem setting tutorial
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_ s instead
Word typesetting (subtotal)
vs2019 第一个MFC应用程序
Word排版(小計)
分布式节点免密登录
L2-006 tree traversal (25 points)
[蓝桥杯2017初赛]包子凑数
使用lambda在循环中传参时,参数总为同一个值