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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

this array elements must be scalar

ptc-5185015
4-Participant

this array elements must be scalar

can anyone please help me with following:

ptc5185015_1-1710234480447.png

 

Worked well in Mathcad 15, Prime 9 doesn't like it... Best regards

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ptc-5185015)

Can not tell from the picture alone what the culprit may be.

Unless you expect a single value es result for the last expression (vector dot product) I guess that the expression needs vectorization.

For further help you should attach a worksheet. Preferably one with stripped down sample data not needing the Excel sheet which does show the same error.

 

Furthermore your program should return a value for ANY input (LoadCase) even though you may think that the case can not exist.
Your program so far does not provide a return value for LoadCase <100, LoadCase>408 and LoadCase in the range from 208 to 400! Guess this is the reason for the error.

You are on the safe side if you use "else if" and "else" and also explicit "return" statements (not mandatory, but good style).

Werner_E_1-1710243084809.png

You may omit the return statements

Werner_E_3-1710243613435.png

or you may omit the "else" branches

Werner_E_4-1710243641433.png

but not both (as otherwise the result would always be 0 or whatever you choose as return value for LoadCases not in the two ranges [100;208] or [400;408])

You may also use the if-function instead of the programmed if-statement

Werner_E_5-1710243793124.png

and you may even create the very same vector without using the range "r" is as follows:

Werner_E_2-1710243134661.png

Note that the expression has to be vectorized.

 

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:ptc-5185015)

Can not tell from the picture alone what the culprit may be.

Unless you expect a single value es result for the last expression (vector dot product) I guess that the expression needs vectorization.

For further help you should attach a worksheet. Preferably one with stripped down sample data not needing the Excel sheet which does show the same error.

 

Furthermore your program should return a value for ANY input (LoadCase) even though you may think that the case can not exist.
Your program so far does not provide a return value for LoadCase <100, LoadCase>408 and LoadCase in the range from 208 to 400! Guess this is the reason for the error.

You are on the safe side if you use "else if" and "else" and also explicit "return" statements (not mandatory, but good style).

Werner_E_1-1710243084809.png

You may omit the return statements

Werner_E_3-1710243613435.png

or you may omit the "else" branches

Werner_E_4-1710243641433.png

but not both (as otherwise the result would always be 0 or whatever you choose as return value for LoadCases not in the two ranges [100;208] or [400;408])

You may also use the if-function instead of the programmed if-statement

Werner_E_5-1710243793124.png

and you may even create the very same vector without using the range "r" is as follows:

Werner_E_2-1710243134661.png

Note that the expression has to be vectorized.

 

ptc-5185015
4-Participant
(To:Werner_E)

Werner_E - thank you for your prompt reply and number of options for solution . All tested and working.  All best

Announcements

Top Tags