Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Software used: Mathcad Prime 10
There are 2 Matrices defined as below:
I want to create a function with these 2 matrices as input, to compare the values of 1 matrix to the other.
How can i do this?
I tried doing it like below, But it seems that a function depending on another variable (pnumber or row in this case) cannot be given as an input to another function.
IsParamMatch(RBoM_fixed_params_list(pnumber),RParameter_fixed_params_list(row))
Indeed, you cannot define a function where the parameters to the function are function calls.
But you can define a function where the parameters to the function are function names. So simply define:
IsParam( f1 , f2 ):=if (f1=f2 , <whatever> , <orelse> )
Then you define values for pnumber and row, and you call that function with:
IsParamMatch( RBoM_fixed_params_list(pnumber) , RParameter_fixed_params_list(row) )=
and it will produce <whatever> in case RBoM_fixed_params_list(pnumber) equals RParameter_fixed_params_list(row), and it will produce <orelse> in the other case.
For more flexibility you could define:
IsParam( f1 , f2 , p , r ):=if ( f1(p) = f2(r) , <whatever> , <orelse> )
and call it with:
IsParamMatch( RBoM_fixed_params_list , RParameter_fixed_params_list , pnumber , row )=
Here's a small example:
Success!
Luc
P.S. You should attach your worksheet...
Hello!
What is "IsEqual"?
Best regards,
Sergey
The name of the function I defined just below the definition of Fun1 and Fun2.
Success!
Luc
Yes, of course, I had to see it.
Hi @VN_13282660,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag
