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.
向量不起作用
z = 10:-1:1; x = 1:9; y = 2:10; z(x:y)
答案=
10 9
没有矢量化索引范围?
如果你想要对,你必须使用
>> z([x; y]) ans = 10 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 1
分别
>> z([x; y].') ans = 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1