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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

For loop

BM_9854393
2-Guest

For loop

I have defined function with "for loop" inside for table content processing. It looks simple, but unfortunately it doesn't work. Instead of calculation results , the message  "This value mus be a scalar a matrix" is being displayed.

I was using this function with Mathacad 15 and it was working fine, but I can't reproduce it within Mathcad Prime 8.

Where did I go wrong?

 

Regards,

Bogdan

1 ACCEPTED SOLUTION

Accepted Solutions

ttokoro already pointed you to the error.

You had an implicit multiplication between "(rows)" and "N.t.".

Werner_E_0-1718321442123.png

It should read "rows(N.t.)" instead!

Werner_E_1-1718321488969.png

Now you should get the expected result:

Werner_E_2-1718321563067.png

You can achieve the very same result without any utility function in one go using a boolean comparison and vectorisation

Werner_E_3-1718321606367.png

Another option is using a simpler utility function, written to be used with just one scalar and called vectorized.

Here are two example for that kind of utility function

Werner_E_0-1718322135229.png

 

 

 

View solution in original post

4 REPLIES 4
ttokoro
20-Turquoise
(To:BM_9854393)

image.png  rows(Nt)

ppal
17-Peridot
(To:ttokoro)

Maybe try

ppal_0-1718316473348.png

 

ttokoro already pointed you to the error.

You had an implicit multiplication between "(rows)" and "N.t.".

Werner_E_0-1718321442123.png

It should read "rows(N.t.)" instead!

Werner_E_1-1718321488969.png

Now you should get the expected result:

Werner_E_2-1718321563067.png

You can achieve the very same result without any utility function in one go using a boolean comparison and vectorisation

Werner_E_3-1718321606367.png

Another option is using a simpler utility function, written to be used with just one scalar and called vectorized.

Here are two example for that kind of utility function

Werner_E_0-1718322135229.png

 

 

 

Thank you for all advices, issue is solved.

 

Regards,

Bogdan

Top Tags