Skip to main content
4-Participant
Solved

Special Insertion of Multiple Vectors into One Vector

I'm thinking I need for loops to insert vectors P, M and V into Q as follows:

P0 into Q0

P1 into Q3

P2 into Q6

P3 into Q9

M0 into Q1

M1 into Q4

M2 into Q7

M3 into Q10

V0 into Q2

V1 into Q5

V2 into Q8

V3 into Q11

I need help with the programming and sequencing.

MJGAnswer
1-Visitor

In both examples, you can simply change the definition of k from "0...3" to "0...last(P)"

4 replies

1-Visitor

How about this?

No programming needed.

Translate
1-Visitor

If you want to do it programmatically, you could go this way:

Translate
hriek4-ParticipantAuthor
4-Participant

What about for an arbitrary sizes of vectors P, M, V? (these vectors will always be the same size)

Translate
MJG1-VisitorAnswer
1-Visitor

In both examples, you can simply change the definition of k from "0...3" to "0...last(P)"

Translate