Main Content

那些

创建所有阵列

描述

x =那些返回标量1

例子

x =nreturns ann-by-n一个矩阵。

例子

x =SZ1,,,,。。。,,,,SZNreturns anSZ1-by -....- by-SZN一系列SZ1,,,,。。。,,,,SZN表示每个维度的大小。例如,一个(2,3)returns a 2-by-3 array of ones.

例子

x =SZ返回一系列大小向量的数组,SZ,定义尺寸(x)。例如,一个([2,3])returns a 2-by-3 array of ones.

例子

x =___,,,,typename还指定了数据类型(类)Xfor any of the previous syntaxes. For example,一个(5,'int8')返回8位整数的5 x-5矩阵。

例子

x =___,,,,'喜欢',,,,p指定Xhas the same data type, sparsity, and complexity (real or complex) as the numeric variablep

例子

全部收缩

Create a 4-by-4 array of ones.

x =4)
x =4×41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Create a 2-by-3-by-4 array of ones.

x =2,,,,3,4); size(X)
ans =1×32 3 4

Define a 3-by-2 array一个

a = [1 4;2 5;3 6];sz = size(a)
sz =1×23 2

创建与大小相同的数组一个

X =一个(SZ)
x =3×21 1 11 1 1

创建一个1 x-3向量的矢量,其元素是16位未签名的整数。

x =1,,,,3,'uint16'),
x =1x3 UINT16行矢量1 1 1
class(X)
ans ='uint16'

创建标量1that is not real valued, but instead is complex like an existing array.

Define a complex vector.

p= [1+2i 3i];

创建标量1那很复杂p

x ='喜欢',p)
x =1。0000+ 0.0000i

定义8位未签名整数的2 x-3阵列。

p = uint8([1 3 5; 2 4 6]);

创建与大小和数据类型相同的数组p

x =一个(size(p),'喜欢',p),,,,
x =2x3 uint8 matrix1 1 11 1 1
class(X)
ans ='uint8'

输入参数

全部收缩

正方形矩阵的大小,指定为整数值,将输出定义为一个正方形,n-n b的n-n矩阵。

  • 如果n0, 然后X是一个空矩阵。

  • 如果n是negative, then it is treated as0

数据类型:双倍的|单身的|int8|int16|int32|INT64|UINT8|uint16|UINT32|Uint64

每个维度的大小,,,,specified as two or more integer values, definesX作为a sz1-by...-by-szN array.

  • 如果任何维度的大小为0, 然后X是一个空数组。

  • 如果任何维度的大小为负,则将其视为0

  • 如果有任何尾随的尺寸大于2大小1, 然后the output,X,,,,does not include those dimensions.

数据类型:双倍的|单身的|int8|int16|int32|INT64|UINT8|uint16|UINT32|Uint64

Output size, specified as a row vector of integer values. Each element of this vector indicates the size of the corresponding dimension.

  • 如果任何维度的大小为0, 然后X是一个空数组。

  • 如果任何维度的大小为负,则将其视为0

  • 如果有任何尾随的尺寸大于2大小1, 然后the output,X,,,,does not include those dimensions.

Example:sz =[2 3 4]定义X作为2 x-3 x-4阵列。

数据类型:双倍的|单身的|int8|int16|int32|INT64|UINT8|uint16|UINT32|Uint64

输出类,指定为'双倍的',,,,'单身的',,,,“逻辑”,,,,'int8',,,,'uint8',,,,'int16',,,,'uint16',,,,'int32',,,,'uint32',,,,'int64', 或者'uint64'

原型,指定为变量。

数据类型:双倍的|单身的|逻辑|int8|int16|int32|INT64|UINT8|uint16|UINT32|Uint64
复杂的数字支持:万博1manbetx是的

扩展功能

版本历史记录

Introduced before R2006a