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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

For loop

BM_9854393
2-Explorer

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

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:BM_9854393)

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

 

Werner_E
25-Diamond I
(To:BM_9854393)

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

Announcements

Top Tags