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

Adding a scalar to every other Column in a Matrix

MM_10946130
5-Regular Member

Adding a scalar to every other Column in a Matrix

Using: MathCAD Prime 9.0

Hello,

I am trying to add a scalar value to every other column in a large matrix (each element in an even column). I included a screenshot below of a small scale example of the input matrix M, scalar value to add, and the desired output. I thought this might be able to be accomplished using a for loop of some kind looping through the elements and only adding the scalar to the even columns, but I wasn't able to figure out how to do this.

Screenshot 2024-02-05 180237.png

The real application is I have a large matrix of time and current values with every other column being the time columns, and want to add a scalar value to shift the time values.

 Any help would be greatly appreciated!

ACCEPTED SOLUTION

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

I would suggest using a small user-written utility function (which also should be ORIGIN-aware for maximal portability):

Werner_E_0-1707189791845.png

Prime 9 sheet attached

 

View solution in original post

2 REPLIES 2

Hi,,

Capture.JPG

Werner_E
25-Diamond I
(To:MM_10946130)

I would suggest using a small user-written utility function (which also should be ORIGIN-aware for maximal portability):

Werner_E_0-1707189791845.png

Prime 9 sheet attached

 

Announcements

Top Tags