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

Convert vector element into a scaler for evaluation in a while loop

Newbie

Convert vector element into a scaler for evaluation in a while loop

Hi all,

I am attempting to extract a vector element piecewise within a while loop and assign it to the while evaluation variable for test.  I am able t do this once before I enter the loop but I cannot do this once in the loop and I get the "Array index is invalid message".  Is there a way to conveniently extract the element and assign it to the evaluation variable?  I am not a strong coder, clearly, I do not understand something.

Any help would be greatly appreciated.

 

4 REPLIES 4

Re: Convert vector element into a scaler for evaluation in a while loop

 

Re: Convert vector element into a scaler for evaluation in a while loop

Hi, zero based array indexing is the default.  With one unknown only have columns 0 and 1

Capture.JPG

Re: Convert vector element into a scaler for evaluation in a while loop

You have an undefined variable " n ".  You test for n>0, which fails so the Rkadapt never executes.

Annotation 2019-10-14 093117.jpg

Re: Convert vector element into a scaler for evaluation in a while loop


@FredKohlhepp wrote:

You have an undefined variable " n ". 


n is delivered as the first function argument.

Announcements