Unable to perform assignment because the size of the left side is 1-by-144 and the size of the right side is 1-by-114.

조회 수: 1(최근 30일)
gorilla3
gorilla3 2019년 2월 21일
댓글: gorilla3 2019년 2월 21일
Hi,
I'm getting the error message described above and I'm not sure why, this is the code:
t1_r=zeros(length(idx1i),144);
for i=1:1:length(idx1i)
t1_r(i,:)= t1(idx1i(i): idx1f(i));
end
it seems correct to me since left and right have the same size... Basically the right side is a vector of 1x144 that I'm trying to stock up in a series of rows creating matrix tr_1.
Hopefully you'll be able to help!
Thanks!

채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 2월 21일
Probably the problem is that (idx1i(i): idx1f(i)) it's not of 144 size. You probably need to put the range in t1_r variable, for example:
t1_r=zeros(length(idx1i),144);
for i=1:1:length(idx1i)
t1_r(i,idx1i(i): idx1f(i))= t1(idx1i(i): idx1f(i));
end
  댓글 수: 1
gorilla3
gorilla3 2019년 2월 21일
Ahhh it was a typo! I'm sorry, it clearly says 114, and I read it as 144. Problem solved! Thanks

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by