码迷,mamicode.com
首页 > 编程语言 > 详细

Python中怎样使用shape计算矩阵的行和列

时间:2014-12-04 17:18:47      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   sp   on   div   log   as   

1 >>> a=mat([[1,2,3],[5,6,9]]);
2 >>> a
3 matrix([[1, 2, 3],
4         [5, 6, 9]])
5 >>> shape(a)[0]
6 2
7 >>> shape(a)[1]
8 3

如上面的a矩阵,2行3列;计算行使用shape(a)[0];计算列使用shape(a)[1];

Python中怎样使用shape计算矩阵的行和列

标签:style   blog   color   使用   sp   on   div   log   as   

原文地址:http://www.cnblogs.com/yuzhuwei/p/4143044.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!