how to code i included in A

2 次查看(过去 30 天)
ad lyn
ad lyn 2022-5-6
回答: Voss 2022-5-6
how to code " i included in A"

采纳的回答

Voss
Voss 2022-5-6
Maybe you can use ismember. (Here I'm using ii to avoid ambiguity with the imaginary unit 1i, a.k.a., i.)
ii = 3;
A = [1 2 3 4 5];
ismember(ii,A) % ii is in A
ans = logical
1
ii = [6 7];
A = [2 4 6 8 10];
ismember(ii,A) % ii(1) is in A, ii(2) is not
ans = 1×2 logical array
1 0

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by