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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

7-Bedrock

## Issues with Solve Block

I'm trying to set up a solve block so I can call it as a function. In the this case it will find what cable size matches the manufacturers specifications and return the subscript for which it is at. But it keeps telling me that the variable is undefined. Can you explain what I'm doing wrong here?

ACCEPTED SOLUTION

Accepted Solutions
21-Topaz I
(To:Johnruehlz)

Hi,

You have the wrong equal sign.

You need to change the if blocks to use otherwise statements, as Luc has pointed out you always get 5

10 REPLIES 10
17-Peridot
(To:Johnruehlz)

What solve block?

How about now as per attached?

23-Emerald III
(To:ppal)
Subscription ALWAYS results in 5, due to the last statement of the program.

Luc
21-Topaz I
(To:Johnruehlz)

Hi,

You have the wrong equal sign.

You need to change the if blocks to use otherwise statements, as Luc has pointed out you always get 5

24-Ruby IV
(To:terryhendicott)

May be the built-in function match solves you problem

7-Bedrock
(To:ValeryOchkov)

Sorry for ignorance. Could you explain a little more in detail with what I'm trying to accomplish? I'm trying to be able to use this to determine the correct set of manufacturer specifications for the given wire gauge, that needs to be used for the equation such as Rposseq,Xposseq,Rzeroseq, etc... that can use "i" to be able to shift through the equation to given all the answers for the table

21-Topaz I
(To:Johnruehlz)

Hi.

I hope my understanding is correct but here goes.

A circuit table that lists four circuits [0 - 3]

A cable table that lists five manufacturer's data [0 - 4]

Common to both tables is cable size column.

What you want to do is for each circuit look up the cable table in order to do some calculations for the circuit

In database terminology you are performing an query using both tables

This can be done with the match statement.

See enclosed file: index into cable table rows calculated from row x of curcuit table.

25-Diamond I
(To:terryhendicott)

Instead of dealing with a lot of confusing nested if .. otherwise statements, thanks to the way "if" is implemented in Mathcad its sufficient to do as you already did and simply add one single otherwise statement at the and and return "out" as the last line.

Alternatively you could use one of the two following ways:

7-Bedrock
(To:Werner_E)

This doesn't really fix my issue, I can't seem to get rid of the error in the code block and I can't seem to use it as a function because of it, maybe I missed something but, I reloaded the files to see if maybe I did something wrong.

This solved my problem but, I used the equals sign on the keyboard any other time it works the correct way, weird.

23-Emerald I
(To:Johnruehlz)

The first time you use the "wrong" equal sign, Mathcad will default to the other; the subsequent use creates a strange effect:

Announcements

Top Tags