1

I want to create multidimensional arrays that repeat a vector along along the other dimensions. E.g. for row-vectors a and b I can create A which has A(:,n,m,k)=a for all n,m,k and similarly B which has B(n,:,m,k) for all n,m,k as follows:

A=repmat(a', [1 length(b) length(c) length(d)]); B=repmat(b, [length(a) 1 length(c) length(d)]);

How can I do the equivalent for C and D? I.e. such that C(n,m,:,k)=c where c is a row vector.

1 Answer 1

1

Solved it myself, one can use the permute function, e.g.:

B=repmat(b, [length(x) 1 length(a) length(c)]); B=permute(B,[1 3 2 4]);

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.