how to find 'n' number and split vector in to two ?
2 次查看(过去 30 天)
显示 更早的评论
Hello I want to find 'N' Number in vectore and split into two vectors.
A = [1 2 3 4 5 6 7 8 9 10 23 55 66 77 88]
for i = 1:length(A)
if A(:,i) <= 20
X = A(:,i)
else
Y = A(:,i)
end
end
But I want
X = [1 2 3 4 5 6 7 8 9 10]
Y = [23 55 66 77 88]
0 个评论
采纳的回答
madhan ravi
2020-6-23
X = A(A <= 20)
Y = A(A > 20)
You just needed to save the result in each iteration ;)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!