Simple Array Addition
Simple Array Addition
(OP)
I am having a very difficult time with a very simple problem.
I have an array, RoadWidth[n (where n= 1..48). I want to add a constant to each of the values in the array. In my head this can be accomplished with a simple for loop but I just can't get it to work.
for n = 1..48
SubgradeWidth[n = (RoadWidth[n) + 2
This is obviously the wrong way to do it. (I know I could just add an array of the same size that has a 2 in each variable spots but that just seems like it would take up a lot more room on my calc sheet and would take more effort to change the 2 to any other variable that I want at some later date.)
Any insight on this lovely Friday morning?
THANKS
-KD
I have an array, RoadWidth[n (where n= 1..48). I want to add a constant to each of the values in the array. In my head this can be accomplished with a simple for loop but I just can't get it to work.
for n = 1..48
SubgradeWidth[n = (RoadWidth[n) + 2
This is obviously the wrong way to do it. (I know I could just add an array of the same size that has a 2 in each variable spots but that just seems like it would take up a lot more room on my calc sheet and would take more effort to change the 2 to any other variable that I want at some later date.)
Any insight on this lovely Friday morning?
THANKS
-KD
RE: Simple Array Addition
RE: Simple Array Addition
Thank you. I knew it was something simple.
-KD
RE: Simple Array Addition
n:1;48
SubgradeWidth[n: 2+RoadWidth[n
Cheers
Greg Locock
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: Simple Array Addition
Simply typr
SubgradeWidth:Matrix+2
Y
(to get it right assume you are wrong)