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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Translate the entire conversation x

How to write loop inside another loop

YA_10963798
14-Alexandrite

How to write loop inside another loop

Hi there, 

I have a variable with 100 values inside and I want to check every 5 values to find the minimum between them. I need to do that through the entire values ... this means 20 times . I tried to write it this way but not working : 

YA_10963798_0-1765960507471.png

 

YA_10963798_0-1765959984808.png

z , and q are related to each other . q is the resistance at z depth .. 

the results I expect is : the program will check q at each z and will choose the minimum (q , 15MPa) but will do this in intervals 5 values by 5 values . 

 

the sheet can't be attached again . I attached  zip file 

thanks 

Yusra

 

ACCEPTED SOLUTION

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

Here are two implementations of how I understood your question.

The first uses the "submatrix" function to get the minimum of the five values, the second uses a nested for-loop.

Werner_E_0-1765984143091.png

Prime 11 sheet attached

 

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald IV
(To:YA_10963798)

Hi Yusra,

 

Try this:

LucMeekes_0-1765983381872.png

You should be able to call it with:

LucMeekes_1-1765983469479.png

But you'll also need an associated Z array:

LucMeekes_2-1765983536912.png

LucMeekes_3-1765983554729.png

Now you can plot Q versus Z.

 

Success!
Luc

YA_10963798
14-Alexandrite
(To:LucMeekes)

Hi Luc 

in Z array why you used (i-1)*5+3 

Thanks 

Werner_E
25-Diamond I
(To:YA_10963798)

Here are two implementations of how I understood your question.

The first uses the "submatrix" function to get the minimum of the five values, the second uses a nested for-loop.

Werner_E_0-1765984143091.png

Prime 11 sheet attached

 

YA_10963798
14-Alexandrite
(To:Werner_E)

there is one remark here .. the result should be 100 values not 20 values only..... I wanted to compare one by one in each 5 values 

which means we divide the 100 values to 20 groups in each group 5 values > and then compare each member to 15 and choose the minimum... 

The end results will still be 20 groups but with the minimum values.  

 

Announcements

Top Tags