Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I am trying to combine a few load cases (speed and loading combinations) into arrays (or matrix), see simple example of input and what I'd like to achieve. I know how I could use nested FOR to loop through the arrays but I don't know how to assign variables to get the end result.
Or is there a different way? I hardly know anything about functions and programming in Mathcad.
Solved! Go to Solution.
Here are a few suggestions demonstrating different ways to create the vectors or matrices.
If you have any questions or need something different, feel free to come back and ask.
Prime 9 sheet attached
Of course you can create matrices and vectors using for-loops.
But in your attempt I see no loops at all because your "loop" variables are not running over a range of values but are simple single values .
The i<-i+1 statement would only make sense inside a "while" loop. And your program is missing a statement returning the desired result. All variables you are using are just local variables and can't be accessed from worksheet level.
Is not really clear to me what you actually are trying to achieve. Your desired results simply consist in the given vectors, just doubled (stacked) and the new times vector is the vectorized product of the two given time vectors, and then also doubled.
Could be achieved that way:
For further questions please state more clearly which calculations you would like to be done and don't forget to attach you worksheet, not just a picture. And its also advisable to state which version of Prime you are using - especially in case you are not using the latest version.
Hi Werner,
thanks for your reply. I've already learnt something new.
I still need more help, see the file attached. I gave very simple vectors trying to be brief, but they don't have to be the same size - then I can't vectorise time.
So, in my updated example I have 'm=2' number of cases for speed, and 'n=3' number of cases for load, and I need all the possible combinations - the resulting vector size would be m*n=6. Time vector would have a product of corresponding time shares - time share for particular load at particular speed. I hope it will be clearer with the example.
I know that I work with single values in my attempted example - and I wonder how I can apply similar logic to ranges. Also, I wasn't sure about 'return' syntax and function callout - I needed to return three arrays, and it seemed to be accepting scalars only.
I have Prime 9.0
Thanks again,
Ieva
Here are a few suggestions demonstrating different ways to create the vectors or matrices.
If you have any questions or need something different, feel free to come back and ask.
Prime 9 sheet attached
Thank you much! Just what I need.
Ieva