how to find position ?
2 次查看(过去 30 天)
显示 更早的评论
Hello
I'm programming this is my simulator:
x = 5:1:6; y = 7:1:8; x1=62:1:63; y1=61:1:62 ; x2=21:1:22; y2=11:1:12;
[z,v] = test(x, y,x1,y1,x2,y2); % myfunction
C1 = reshape(z,[ ],size(z,2),1); % change matrix dimensions 6D to 2D
C2 = reshape(v,[ ],size(v,2),1); % change matrix dimensions 6D to 2D
C = [C1,C2]; % size 32*4
U = reshape(C,64,2); % size 64*2
frr = reshape(U,32,4); % size 32*2
fr1 = frr(:, 1:2); % split matrix
fr2 = frr(:, 3:4); % split matrix
A = reshape(fr1,[2,2,2,2,2,2]) % change matrix dimensions 2D to 6D
B = reshape(fr2,[2,2,2,2,2,2]) % change matrix dimensions 2D to 6D
V =1.0e+04 * 4.6874; %find the minimum
dif = abs(A-V);
[minf, iLinear] = min(dif(:));
[i1, i2, i3, i4, i5,i6] = ind2sub(size(dif), iLinear) %find the position of that value
x (i1)
y (i2)
x1(i3)
y1(i4)
x2(i5)
y2(i6)
In conclusion . I have a 6D input. (2,2,2,2,2,2) I converted it to 2D.(to do something) I converted it back to 6D as before. I'm not sure. I find the minimum and its position.I will get the correct value. would you recommend what I could do?
Thank you for your kindness.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!