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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Translate the entire conversation x

Calling Matrices as input variables to another function

VN_13282660
2-Explorer

Calling Matrices as input variables to another function

Software used: Mathcad Prime 10

There are 2 Matrices defined as below:

VN_13282660_0-1746188026159.png 

VN_13282660_1-1746188055148.png


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))

 

5 REPLIES 5
LucMeekes
23-Emerald IV
(To:VN_13282660)

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:

LucMeekes_0-1746208168426.png

 

 

Success!
Luc
P.S. You should attach your worksheet...

Sergey
15-Moonstone
(To:LucMeekes)

Hello!

 

What is "IsEqual"?

 

Best regards,

Sergey

LucMeekes
23-Emerald IV
(To:Sergey)

The name of the function I defined just below the definition of Fun1 and Fun2.

 

Success!
Luc

Sergey
15-Moonstone
(To:LucMeekes)

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 

Announcements

Top Tags