problem in using if command

1 次查看(过去 30 天)
Prakhar Modi
Prakhar Modi 2019-7-25
hello everyone,
i have 25 observed values. Now i am generating new 25 values with a formula. Now what I want is that the generated value should b near to any of the observed 25 values.
for example: observed value O= 1 2 3 4 5 6 7 8 9
now I am generating the value using formula: 1+i. So i am writing a code like
for j=1:25
for i=1:50
v(j)=1+i
if(v(j)-O=1)
break
end
end
end
So my question is that I want that the generated value v(1) should have a maximum difference of 1 with any of the observed data O. And when we generate v(2) then again it should have max difference of 1 with observed O but it should not consider that observed value which it has considered during v(1). Means if for v(1) is calculated with difference with O(3), then for v(2) when "if" command executes than it should not consider O(3) again.
  3 个评论
Prakhar Modi
Prakhar Modi 2019-7-25
yes O can have duplicate values. that's just an example i have made. In actual code i have 25 values.
Walter Roberson
Walter Roberson 2019-7-25
https://www.geeksforgeeks.org/maximum-bipartite-matching/

请先登录,再进行评论。

回答(0 个)

类别

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

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by