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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Loop Output Scalar - Should be Vector

atbarajas
1-Newbie

Loop Output Scalar - Should be Vector

Hey everyone,

I've developed a loop where each value in the loop is a vector (e.g., x1 = 30 X 1 vector) so the loop should be returning vectors as well. Unfortunately, I'm getting scalars therefore ruining the later functions of the loop. I've narrowed it down to the portion that is returning scalars, and I was wondering if someone could help me figure out why it's doing this. I've attached the file that has been causing me grief for the past week.

Any help is greatly appreciated.

Talina

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:atbarajas)

On the rhs of the on error you also need the local assignment to Phat[i

View solution in original post

3 REPLIES 3
RichardJ
19-Tanzanite
(To:atbarajas)

On the rhs of the on error you also need the local assignment to Phat[i

Ah, thank you so much! You saved me several additional hours of grief.

StuartBruff
23-Emerald II
(To:atbarajas)

Talina Barajas wrote:

Hey everyone,

I've developed a loop where each value in the loop is a vector (e.g., x1 = 30 X 1 vector) so the loop should be returning vectors as well. Unfortunately, I'm getting scalars therefore ruining the later functions of the loop. I've narrowed it down to the portion that is returning scalars, and I was wondering if someone could help me figure out why it's doing this. I've attached the file that has been causing me grief for the past week.

Any help is greatly appreciated.

Talina

Your loop variable runs from 0 .. 3, but you've only got 3 elements in each of udot and udotdot so the loop crashes at i=3. Change the range from 0..2.

Stuart

Top Tags