1、命令输入
1、Cleaning Up
clear Clears variables from the workspace.
clc Clears the Command Window and moves the cursor to the upper left corner of the window.
2、format
>> format long
Task 2 ✔
>> 13/6
ans =
2.166666666666667
Task 3 ✔
>> format bank
Task 4 ✔
>> 13/6
ans =
2.17
>> format short
>> 13/6
ans =
2.1667
>> help format
3 导入、另存数据文件
4 获取帮助
You can enter
doc fcnName
to get information on any MATLAB function.
5 创建向量
5.1 Create a Row Vector
Use square brackets and separate the values using a comma or a space.
Example
a = [10 15 20 25]
a =
10 15 20 25
Create a Column Vector
Use square brackets and separate the values using a semi-colon.
Example
b = [2;3;5;7]
b =
2
3
5
7
Transpose a Vector
Use the transpose operator '.
Example
c = b’
c =
2 3 5 7
Create a Matrix
Use square brackets and enter values row-by-row. Separate values in a row using a comma or a space, and use a semicolon to start a new row.
Example
A = [1 3 5;2 4 6]
A =
1 3 5
2 4 6
5.2 Creating Evenly-Spaced Vectors
Suppose you want to create a vector containing every integer from 1 to 10. You’ll need to type every number from 1 through 10.
v = [1 2 3 4 5 6 7 8 9 10];
Now what if you want your vector to contain every integer from 1 to 25?
v = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25];
Creating long vectors by manually entering every value can be tedious. In this lesson, you’ll learn to create vectors containing evenly-spaced elements using more compact syntax that uses the colon operator (
标签:10,format,基础,学习,every,MATLAB,using,Example,row
来源: https://blog.csdn.net/flyhelloword/article/details/113741774