how to find 'n' number and split vector in to two ?

1 回表示 (過去 30 日間)
Jeevan Kumar Bodaballa
Jeevan Kumar Bodaballa 2020 年 6 月 23 日
回答済み: madhan ravi 2020 年 6 月 23 日
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]

採用された回答

madhan ravi
madhan ravi 2020 年 6 月 23 日
X = A(A <= 20)
Y = A(A > 20)
You just needed to save the result in each iteration ;)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by