第一步、打开matlab,在命令行窗口中输入a=[1 2 3 4;4 5 6 7;1 2 3 4],按回车键创建一个3行4列的矩阵,如下图所示:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/0dd7912397dda1444d0125cca2b7d0a20cf48640?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
第二步、如果我们想获取矩阵第2行第3列的数据,输入a(2,3),如下图所示:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/bd315c6034a85edf9c87b75d59540923dd547540?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
第三步、想获取矩阵第3列的第一个和第三个,输入a([1 3],3),如下图所示:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/80cb39dbb6fd52668020756abb18972bd4073640?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
第四步、想获取矩阵某列的连续数据,可以使用a(1:2,3),获取第3列第1个到第2个数据,如下图所示:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/a8014c086e061d959e4d7e466bf40ad162d9ca41?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
第五步、使用a(2:end,3)获取第3列,第2个到最后一个数据,根据需要获取矩阵数据,如下图所示:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/359b033b5bb5c9eadef84a9dc539b6003af3b341?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)