my codes are as follow :
when i use this , the loop works
for i=1:3vec=(1+i):(2+i);mat(i,:)=vec;vec=[];end
EDU>> mat
mat =
2 3 3 4 4 5
but when i use this , it shows the error message Subscripted assignment dimension mismatch.
EDU>> for i=1:3vec=(1+i):(3+i);mat(i,:)=vec;vec=[];endSubscripted assignment dimension mismatch.EDU>> for i=1:5vec=(1+i):(3+i);mat(i,:)=vec;vec=[];endSubscripted assignment dimension mismatch.
how can i rectify this ? i need this concept for a huge loop and it shows similar error message when i run my code the matrix generally runs until 5th or 6th row
HELP PLEASE !!!
Best Answer