MATLAB coder gives error while assigning value to the matrix (Subscripted assignment dimension mismatch (size [1 x :?] ~= size [:? x :?]).)

list_size=4;
LLR=zeros(list_size,2*N-1);
initialLRs = zeros(N,1);
initialLRs = -(4*sqrt(Ec)/N0) * y ;
for m=1:list_size
LLR(m,N:2*N-1) = initialLRs;
end
MATLAB coder gives this error "Subscripted assignment dimension mismatch (size [1 x :?] ~= size [:? x :?])." at line 5. "y" is also a matrix of size (N,1). When i run the code without MATLAB coder it runs fine and gives no error. What can i do to remove this error ? Or is there any efficient way of doing what i am doing in this code ?

댓글 수: 1

(As you only showed an snippet of the code, not the whole function, I can't just run it and see what is wrong, so below is just my guess)
Is initialLRs a vector or a matrix? If you run this code in MATLAB, stop inside the loop and size(initialLRs), what it is?
coder thinks initialLRs is a matrix, whereas you are trying to assign it into a vector (LLR(m,:) is a 1-by-someting vector) thus the error.
Maybe you meant zeros(1,N) one thirst assign to initialLRs?
If you are confident that the code is correct, the way to silence the error is to change
LLR(m,N:2*N-1) = initialLRs;
to
LLR(m,N:2*N-1) = initialLRs(1,:);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2016년 9월 16일

댓글:

2016년 10월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by