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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

using while loop with break/continue statement

fahmed-2
13-Aquamarine

using while loop with break/continue statement

Dear all,

 

I have a column of values stored in the variable "i". My intent is, I want to utilize a while loop with a continue/break statement to track a specific range of numbers within the column based on a given input row index. For instance, if I input the row-index value of "4", I would like to extract the range of values from the 4th index of variable "i" until the end.

fahmed2_0-1688955429477.png

 

 

Please help.

 

Thank you

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:fahmed-2)

Thats what the stack() function is made for!

 

new:=stack(i,j)

 

View solution in original post

5 REPLIES 5
Werner_E
25-Diamond I
(To:fahmed-2)

This is what the submatrix() function is made for - look it up in the help.

 

Your example:  submatrix(i, 4, last(i), 0, 0)

 

fahmed-2
13-Aquamarine
(To:Werner_E)

Thabk you for your reply. I intent to use the while loop with break/continue statement because I want each extracted value to be assigned on a separate variable and show the new variable as a range

Werner_E
25-Diamond I
(To:fahmed-2)


@fahmed-2 wrote:

Thabk you for your reply. I intent to use the while loop with break/continue statement because I want each extracted value to be assigned on a separate variable and show the new variable as a range


??????

You would have to give one or better a couple of examples which show what you are looking for.

Show for each example the input values (vector and limit index) and also the data structure you want as a result.

 

You shure would have a hard time to assign each value from 5 to 100 (your given example) to a separate variable and you sure can*t use it as a Prime range variable!

fahmed-2
13-Aquamarine
(To:Werner_E)

Thank you @Werner_E . your approach worked great and saves a lot of effort. I now have two single column matrices ("i" and "j") and would want them to be combined into a single column matrice. The condition would be in the new matrice, the first part will be filled with the values from "i" and immediately after that, the second part will be filled with the values from "j". Both matrices "i" and "j" will have arbitrary range of values .  Please help.

 

fahmed2_0-1688963681925.png

 

Werner_E
25-Diamond I
(To:fahmed-2)

Thats what the stack() function is made for!

 

new:=stack(i,j)

 

Announcements

Top Tags