cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

how to get a value expected from an Array in a given condition??

ychen
1-Newbie

how to get a value expected from an Array in a given condition??

Hi everyone,

I need to know how to get a value expected from an Array in a given condition??

for example, there is two arrays, a and Step.

a contains two values: 0.96 and 1

Step contains two string values: "O" stands for operation condition, and "S" for system test condition.

Now, i wanna a value is equal to 0.96 during the "operation" condition, and equal to 1 for test condition.

I made a programming solution, giving If function to describe my ideas, but it doesn't work. When i re-define Step:="S", then a shows strangely "NA" instead of the value 1 what i expected.

Anyone can help? thanks in advance

6 REPLIES 6

au.png

i try to get the value au in test condition, taping Step:="S" at somewhere, but i still get "0.96".

why??

it seems "au" depends strongly on the first assignment of Step:=, even a more detailed assignment is given in program, but it can't read it !!!

Fred_Kohlhepp
23-Emerald I
(To:ychen)

In your program, Mathcad evaluates "au" as a variable wen it's encountered. In test0, the value of Step was not set, so it defaulted to 0 (the number.) So the evaluation of au came back "NA". The fact that you defined Step below that did not change the value of au.

The solution is to make au a function of Step, see the attached file. au(Step);=

Now each time we encounter au(), we evaluate it for whatever is in the parenthesis.

Werner_E
24-Ruby V
(To:ychen)

It seems to me that you want to define au before you decide which value Step should get. If thats true you will have to use a function.

Probably a listbox component is an option. See attached worksheet for two examples

WE

Sorry, I was too late. I haven't seen your second question and Freds answer while typing my post.

ychen
1-Newbie
(To:Werner_E)

Hi guys,

Thanks for all your help.

PS: Werner, it's cool your solution, i've never used it before (actually, i'm new user since last week, haha), thanks for sharing..

Top Tags