matlab- 数组的常用函数

本文介绍了MATLAB中数组的一些基本操作,包括排序、求和、找出最小值和最大值,以及数组的拼接和乘法等。通过示例展示了`sort`、`sum`、`min`、`max`、`cat`等函数的用法,同时提到了`cat`函数在不同维度下的数组连接方式。
摘要由CSDN通过智能技术生成

>> a=[1,2,3]

a =

     1     2     3

>> sort(a)

ans =

     1     2     3

>> sum(a)

ans =

     6

>> min(a)

ans =

     1

>> max(a)

ans =

     3

>> b=[6,7,8]

b =

     6     7     8

>> a+b

ans =

     7     9    11

>> 3*a

ans =

     3     6     9

>> cat(1,a,b)

ans =

     1     2     3
     6     7     8

>> cat(2,a,b)

ans =

     1     2     3     6     7     8

>> help cat
 cat Concatenate arrays.
    cat(DIM,A,B) concatenates the arrays A and B along
    the dimension DIM. 
    cat(2,A,B) is the same as [A,B].
    cat(1,A,B) is the same as [A;B].
 
    B = cat(DIM,A1,A2,A3,A4,...) concatenates

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值