Skip to main content
1-Visitor
July 9, 2014
Solved

Using Lookup Function in Program

Hello Guys,

I have a problem in my mathcad program.

I was trying to use lookup function in a loop, Attached is the file illustrating my problem.

I was able to use lookup function and get the desired output, but when I have used the same function in a program, I was not getting any errors but it was giving the output as [1,1].

I was still a learner of mathcad and not able figure it out. Could any one plaese help me to resolve this issue, May be my example I have attached here is smaller one, but my real problem contains huge matrix and I need to use lookup function (or if any other) in program to get the desired output.

Thanks a ton for your help!!

Ashok

23-Emerald I
July 9, 2014

The lookup function is set up to return a vector (in case there are more than one matches to the value you're looking for. The [1,1] is telling you that there is a one element array answer. Try putting "[0" immediately after the lookup function (asking for the first element of the vector.)

4 replies

23-Emerald I
July 9, 2014

The lookup function is set up to return a vector (in case there are more than one matches to the value you're looking for. The [1,1] is telling you that there is a one element array answer. Try putting "[0" immediately after the lookup function (asking for the first element of the vector.)

Translate
avarma1-VisitorAuthor
1-Visitor
July 9, 2014

It is working now.

Thanka a lot Fred!!!

Translate
Werner_E
25-Diamond I
July 9, 2014

Fred has already explained the reason for the behaviour you are experiencing and how to deal with it.

See the attached file for some more details.

Translate
avarma1-VisitorAuthor
1-Visitor
July 9, 2014

Thanks a lot Werner for your help.

Translate