Assigning matrices

Dear all;

I’m new in Julia and I’m trying to index one matrix to another.
Let’s say, I have a matrix A of zero (242x970) and I want to assign a Matrix B,C and D in a specific part of A.

A=zeros(M+1,nf+1);
A[2:M+1,2:nf+1]=B;
A(1,2:nf+1) = C;
A(2:M+1,1) = D;

M and nf are 241 and 969, respectively.

I can assign B but I’m getting errors when trying to assign C and D.
Can you help me identify what I’m doing wrong.

Thanks in advance.

You’re using parenthesis instead of brackets for those two?

4 Likes

In addition to the syntax error @lmiq noted above, see: Please read: make it easier to help you … in particular, quote your code and post runnable code snippets (e.g. provide values for M, nf, B, C, and D, even if they are just random numbers).

Thank you very much!

Also please mark the reply by @lmiq as the solution, to close out this thread.