Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Matlab 中有一个 6639x5 矩阵,我想以特定顺序选择某些特定行(比如第 1、11、21、31 行......以及随后添加 10 直到结束)以形成一个新矩阵。有什么想法吗?谢谢你,奥蒂。
subset = a(1:10:end, :);
选择每 10 行直到最后,以及所有列。
例子:
>> a = magic(5) a = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 >> a(1:2:end, :) ans = 17 24 1 8 15 4 6 13 20 22 11 18 25 2 9