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

## Basic If Functions Applied to Arrays Derived from Spreadsheet Data  4-Participant

## Basic If Functions Applied to Arrays Derived from Spreadsheet Data

I'm fairly new to the use of arrays and matrices in general. I'm in the crane design industry and modern codes require multiple load combinations to be analysed in structural calculations simultaneously. Codes then often pose choices based on things like stress ratios. For example, in it's simplest form, a different set of rules are required if a stress is in compression rather than in tension. I need the ability to automatically differentiate between these stresses, and the correct rules are applied for each load combination. Sometimes these problems may use array sizes in the hundreds. I've attached a very basic programme. My desired outcome is a single n x 1 array. What I tend to get is an array of nested arrays. I've played around and found that if I were to transpose this and turn the nested array into a single clean matrix, use the diagonal function, then this would give me what I need. I have no idea how to do this though. Help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions  19-Tanzanite
(To:JJ_9094500)    3 REPLIES 3  19-Tanzanite
(To:JJ_9094500)      4-Participant
(To:ttokoro)

Thank you!  23-Emerald II
(To:JJ_9094500)

For those with only Mathcad Prime Express, here's an Express 7 solution:  Stuart

Note: this would have been a lot easier if "if" was a true function that could be vectorized over. That way, the vectorized operator could be contained within prog1 and prog2 instead of needing to be defined as first scalar functions (_prog1 and _prog2) and then as (vectorized) array functions.

Help says the same thing that it has done since Mathcad first crawled out of the sea: "if is a (PTC) Mathcad control operator, not a function, and it does not work with operators that modify functions, such as the vectorize operator.".  Which explains everything and nothing. Announcements