while循环获取条件的开始/结束值 [英] While loop to get start/end values of condition

查看:94
本文介绍了while循环获取条件的开始/结束值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


我希望有人可能会就完成以下问题的最佳方法提出建议。


我有一堆道路。每条道路都有一个起点和终点距离(以米为单位的链条),并且在过去的40年里可能已经分成多个部分。每个密封部分也有一个起始值和结束值,它们可能相互重叠。


我设法将这些信息输入到一个stocck类型的图表中,该图表显示了远距离的密封年份类型格式。从这里我可以直观地看到道路的年龄以及如何拆分这些部分。


我希望能够总结这些数据以自动获得最新的印章。道路委托长度的起点和终点值。


我看到这种情况在一段时间内完成,其中X =道路总长度,

XS =段开头的价值

XE =段末段的谷物

Y =印章年份


因此


XS = 0

XE = 0

而XE< = X


得到Y值

增加XE值直到Y值改变

将XS XE Y写入表格

将XS设置为等于最后XE

并重复直到道路尽头。


我想要的最终结果是一张ROAD_ID,开始,结束,印章年份表。


希望一切都有意义。


我可能只是在寻找错误的单词,但如果有人有任何例子我可以参考那将是太棒了。


干杯,


劳拉

解决方案

< blockquote>这有点难以理解,你能预先发布一个数据的例子,以及之后的样子吗?



大家好,


我希望有人可能会就完成以下问题的最佳方法提出建议。


我有一堆道路。每条道路都有一个起点和终点距离(以米为单位的链条),并且在过去的40年里可能已经分成多个部分。每个密封部分也有一个起始值和结束值,它们可能相互重叠。


我设法将这些信息输入到一个stocck类型的图表中,该图表显示了远距离的密封年份类型格式。从这里我可以直观地看到道路的年龄以及如何拆分这些部分。


我希望能够总结这些数据以自动获得最新的印章。道路委托长度的起点和终点值。


我看到这种情况在一段时间内完成,其中X =道路总长度,

XS =段开头的价值

XE =段末段的谷物

Y =印章年份


因此


XS = 0

XE = 0

而XE< = X


得到Y值

增加XE值直到Y值改变

将XS XE Y写入表格

将XS设置为等于最后XE

并重复直到道路尽头。


我想要的最终结果是一张ROAD_ID,开始,结束,印章年份表。


希望一切都有意义。


我可能只是在寻找错误的单词,但如果有人有任何例子我可以参考那将是太棒了。


干杯,


Laura



只需订阅并等待来自OP的数据。



只需订阅并等待来自OP的数据。



对此我很抱歉,我应该发布一个例子。


只要说我有一条道路的以下数据


Road_id start_Seal End_seal治疗年份

100: 01 0 100 primerseal 1981

100:01 0 100 finalseal 1992

100:01 50 200 reseal 1997

100:01 125 150 reseal 2001


我想将这些信息重新分解为逻辑片段,这些片段将给出一个线性时间轴(在本例中为长度线)以给出距离与年龄的关系。




Road_id start_Seal End_seal治疗年份

100:01 0 50最终印章1992

100:01 50 125重新安装1997

100:01 125 150重新安装2001

100:01 150 200转售1997年


细分现在是0-50,50-125,125-150,150-200只有最新治疗和年度相关的每个距离沿着这些结果将与其他数据结合成一个公式,用于预测道路何时需要重建。


希望这更有意义......


Hello All,

I was hoping that someone might have a suggestion on the best way to complete the follwoing problem.

I have a bunch of roads. Each road has a Start and end Distance (chainage in metres) and may have been sealed in multiple sections over the last 40 years. Each seal section also has a start and an end value and they may overlap each other.

I have managed to get this information into a stocck type graph which displays the seal in a distance verses year type format. From this I can visually see the age of the road and how the sections should be broken up.

I want to be able to summarize this data to automatically get the the latest seal with a start and end value for the entrire length of road.

I see this kind of done in a while loop where X = total length of road,
XS = value of start of segments
XE = Vale of end of segment
Y = year of seal

therefore

XS = 0
XE= 0
while XE<= X

get Y value
increment XE value until Y value changes
write XS XE Y to table
set XS to equal last XE
and repeat until end of road reached.

The final result that I want is a table of ROAD_ID, Start, End, Year of seal.

Hopefully that all makes sense.

I am probably just searching for the wrong words but if anyone has any examples that I can refer to that would be fantastic.

Cheers,

Laura

解决方案

It''s a little hard to follow, can you post up an example of the data before hand, and what it should look like after?


Hello All,

I was hoping that someone might have a suggestion on the best way to complete the follwoing problem.

I have a bunch of roads. Each road has a Start and end Distance (chainage in metres) and may have been sealed in multiple sections over the last 40 years. Each seal section also has a start and an end value and they may overlap each other.

I have managed to get this information into a stocck type graph which displays the seal in a distance verses year type format. From this I can visually see the age of the road and how the sections should be broken up.

I want to be able to summarize this data to automatically get the the latest seal with a start and end value for the entrire length of road.

I see this kind of done in a while loop where X = total length of road,
XS = value of start of segments
XE = Vale of end of segment
Y = year of seal

therefore

XS = 0
XE= 0
while XE<= X

get Y value
increment XE value until Y value changes
write XS XE Y to table
set XS to equal last XE
and repeat until end of road reached.

The final result that I want is a table of ROAD_ID, Start, End, Year of seal.

Hopefully that all makes sense.

I am probably just searching for the wrong words but if anyone has any examples that I can refer to that would be fantastic.

Cheers,

Laura

Just subscribing and waiting for data from OP.


Just subscribing and waiting for data from OP.

Sorry about that, I should have posted an example.

Just say that I have the following data for a road

Road_id start_Seal End_seal treatment year
100:01 0 100 primerseal 1981
100:01 0 100 finalseal 1992
100:01 50 200 reseal 1997
100:01 125 150 reseal 2001


I want to rebreak this information into logical segments which will give a linear timeline (in this case lengthline) to give distance vs age.

ie


Road_id start_Seal End_seal treatment year
100:01 0 50 final seal 1992
100:01 50 125 reseal 1997
100:01 125 150 reseal 2001
100:01 150 200 reseal 1997


segments are now 0-50, 50-125, 125-150, 150-200 with only the latest treatment and year associated with each distance along the road.

These results will be combined with other data into a formula that will be used to predict when a road will need to be rebuilt.

Hopefully that makes a little more sense....


这篇关于while循环获取条件的开始/结束值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆