Skip to main content
1-Visitor
May 12, 2011
Solved

Loop Output Scalar - Should be Vector

  • May 12, 2011
  • 3 replies
  • 2988 views

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

Best answer by RichardJ

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

3 replies

RichardJ19-TanzaniteAnswer
19-Tanzanite
May 12, 2011

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

atbarajas1-VisitorAuthor
1-Visitor
May 12, 2011

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

23-Emerald V
May 12, 2011

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