[英]Java: how do icheck if a certain character is within a string, then print out the position it is in relative to the string?
[英]How to print binary string of certain position
考虑
a = dec2bin(rand(5,1)*100);
X = 3:7;
Z = 2:6;
for i = 1:5
y = abs(X(i)-Z);
dm = min(y);
D(i) = find(y==min(y));
end
D2 = D'
b = a(D')
输出是
a =
01001
01110
10000
10011
11111
X =
3 4 5 6 7
Z =
2 3 4 5 6
D2 =
2
3
4
5
5
b =
0
1
1
1
1
为什么它没有回来
b = [01110
10000
10011
11111]
我将如何获得此输出?
采用
b=dec2bin(a(D'))
这给了我:
b =
110001
110000
110001
110000
110000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.