MATLAB - 提取矩阵的行 [英] MATLAB - extracting rows of a matrix

查看:41
本文介绍了MATLAB - 提取矩阵的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

a = [1 2;3 4;5 6] 我想提取a的第一行和第三行,所以我有x = [1;3](行索引).

a = [1 2; 3 4; 5 6] I want to extract the first and third row of a, so I have x = [1; 3] (indices of rows).

a(x) 不起作用.

推荐答案

像这样:a([1,3],:)

逗号分隔维度,:表示整个范围",方括号构成一个列表.

The comma separates the dimensions, : means "entire range", and square brackets make a list.

这篇关于MATLAB - 提取矩阵的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆