![]() |
如何在Matlab中迭代列向量?
[INDENT] [B]可能重复:[/B]
[URL="https://stackoverflow.com/questions/758736/how-do-i-iterate-through-each-element-in-an-n-dimensional-matrix-in-matlab"]如何在MATLAB中遍历n维矩阵中的每个元素?[/URL] [/INDENT]我有一个列向量list ,我想这样迭代: for elm in list //do something with elm 怎么样? [B]回答:[/B] 在Matlab中,您可以直接遍历列表中的元素。如果您不需要知道当前正在使用哪个元素,这将很有用。 这样你就可以写 for elm = list %# do something with the element end 请注意,Matlab遍历list的列,因此,如果list是nx1向量,则可能需要转置它。 [url=https://stackoverflow.com/questions/3461509]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:09。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.