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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Overflow during using step range function

RR_10484311
4-Participant

Overflow during using step range function

overflow.PNG

working fine.PNGHi, I have problem with step range function when I put step which gives me array with more than 5000 elements. It gives me an error with overflowing. It is really strange for me because when I insert an array with more than 5000 elements from excel table, it works fine. So, do you know why this is happening, because 5000 elements doesn't sound too big for me. If it's overflowing, do you know other way how I can make an array with size of inserted array from excel, because it is important for me that number of elements of array can vary with using other excel tables.

 

Thanks in advance and Best Regards!

  

ACCEPTED SOLUTION

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

Try to avoid inline evaluations!

Instead of theta:=....= simply use theta:=..... (without the equal at the end) and let the variable theta display in a separate region.

Inline evaluations often work OK and indeed they should do so, but experience shows that ever so often they are responsible for some quite exotic and not understandable errors. So its a good habit to avoid them throughout (like after the definition of your variable A)

Furthemore its an undocumented feature that using an inline evaluation when defining a range, doing so turns the range into a vector. Its convenient but nonetheless should be used with care and only if you are aware of this feature. But probably you knew about that and need theta to be a vector as the way you defined variable j would only work that way. If thats the case I would suggest creating the vector the "classic", "legal" way.

Werner_E_0-1667993464847.png

or avoiding a worksheet range i by using a programmed loop

Werner_E_1-1667993548403.png

 

BTW, is always better to include the worksheet itself as well and not just posting screenshots. If sharing the data is an issue you may create a sheet using dummy data showing the problem as well.

View solution in original post

7 REPLIES 7
Werner_E
25-Diamond I
(To:RR_10484311)

Try to avoid inline evaluations!

Instead of theta:=....= simply use theta:=..... (without the equal at the end) and let the variable theta display in a separate region.

Inline evaluations often work OK and indeed they should do so, but experience shows that ever so often they are responsible for some quite exotic and not understandable errors. So its a good habit to avoid them throughout (like after the definition of your variable A)

Furthemore its an undocumented feature that using an inline evaluation when defining a range, doing so turns the range into a vector. Its convenient but nonetheless should be used with care and only if you are aware of this feature. But probably you knew about that and need theta to be a vector as the way you defined variable j would only work that way. If thats the case I would suggest creating the vector the "classic", "legal" way.

Werner_E_0-1667993464847.png

or avoiding a worksheet range i by using a programmed loop

Werner_E_1-1667993548403.png

 

BTW, is always better to include the worksheet itself as well and not just posting screenshots. If sharing the data is an issue you may create a sheet using dummy data showing the problem as well.

RR_10484311
4-Participant
(To:Werner_E)

But I need that theta for additional calculations, and when I use theta , an error appears "this variable is undefined". I can't share a whole worksheet because of privacy of the project.

Werner_E
25-Diamond I
(To:RR_10484311)

See my edited reply above. Your calculations seem to need theta be a vector and not a range. I added two ways to create this vector without using that undocumented inline eval feature.

2.PNG

Sorry, this error appears, and I try with vectorization as you see.

P.S. I didn't mention it, it's PTC Mathcad prime 7.0.0.0. 

Werner_E
25-Diamond I
(To:RR_10484311)

vectorization only affects operations where vectors are involved.

Vectorization of a range has no effect at all. It does not turn the range into a vector as you might have suspected.

 

RR_10484311
4-Participant
(To:Werner_E)

Thanks, second solution works!

Werner_E
25-Diamond I
(To:RR_10484311)


@RR_10484311 wrote:

Thanks, second solution works!


The first should work as well. If it didn't the reason probably is that you used a literal subscript instead of a vector/matrix subscript.

Announcements

Top Tags