Skip to main content
1-Visitor
November 30, 2018
Solved

Extracting values in a matrix

  • November 30, 2018
  • 7 replies
  • 3805 views

Hello.

I am trying to extract values from a matrix according to certain restrictions, with no success! In the file attached is the attempt. Any help would be greatly appreciated. 

Capture.PNG

Best answer by LucMeekes

From a quick observation:

You can remove i from your program altogether, and use j to index r.

But the problem lies in the fact that only the first if statement is within the for loop.

I think you want all three if statements in that loop.

 

Success!
Luc

7 replies

24-Ruby III
November 30, 2018
LUBR1-VisitorAuthor
1-Visitor
November 30, 2018

Hi.

Thank you, but I think I wasn't very clear. This is what I am trying to do:

Capture.PNG

LucMeekes23-Emerald IVAnswer
23-Emerald IV
November 30, 2018

From a quick observation:

You can remove i from your program altogether, and use j to index r.

But the problem lies in the fact that only the first if statement is within the for loop.

I think you want all three if statements in that loop.

 

Success!
Luc

25-Diamond I
November 30, 2018

Here are some more ways using vectorized function calls:

B.PNG