Skip to main content
Best answer by Werner_E

If you make the changes I had shown and replace the wrong q.... you should get a result and your expression for Q.CPT should be a vector with 5 (not 6 because your range i.n runs only from 1 to 5) large vectors.

Did you notice the remarks i made at the end of my last answer?

Any value between 12 MPa and 15 MPa would be set to zero. If thats not your intention but you rater want that value to be unchanged, you cold add the green highlighted statement.

The result vectors still will have one element less than the input and its first element will always be zero because q[1 never gets assigned a value.

Werner_E_0-1717671892374.png

 

Maybe its an option for you not to use the range i.n  at all and use vectorization. That way all six vectors in q...anchors are used and not only the first five.

Werner_E_1-1717672073874.png

 

 

 

1 reply

25-Diamond I
June 5, 2024

Your program uses a loop running from O+1 to last(z).

ORIGIN is set to 1 and z is a vector with just six(!!) elements (each of them is a larger vector).

So the loop is just run 5 times and the result is a vector with just six elements, the first one is never defined and defaults to zero.

Here an example:

Werner_E_0-1717592225566.png

 

14-Alexandrite
June 6, 2024

if you may have noticed that z is a matrics contains 6 matrics 

I want to write a program for each matrics is z 

Like the first row in z is a matric (1339X1) I want the function to be applied in all of them. 

25-Diamond I
June 6, 2024

@YA_10963798 wrote:

if you may have noticed that z is a matrics contains 6 matrics 

I want to write a program for each matrics is z 

Like the first row in z is a matric (1339X1) I want the function to be applied in all of them. 


Which function?

I don't see any function which could be applied to a 1338 element vector.

You could make the yellow highlighted change but then the function would fail because of the usage of the green highlighted  q.cza which only has 35 elements.

Werner_E_2-1717670993868.png

You may also reconsider the logic of your program. If both if-conditions fail, q.i is not assigned a value (and would default to zero). Is this really what you had in mind?

Furthermore, the result vector will now have one element less than the input vector and its first element will always be zero because it never gets a value assigned.