add vector to an existing matrix
조회 수: 113 (최근 30일)
이전 댓글 표시
hi,
I have the follogin problem: I have a matrix cosisting of 8 columns and 19599 rows and I would first generate a column vector with 19599 elements and add this to the existing matrix. I tired the following:
data9= zeros(size(data8,1),9);
data9(:,1:8) = data8;
where data 8 is the existing matrix with 8 columns and I am intending to create a nineth column which can be fillled.
and then I did
data9(i,9) = moneyness;
unfortunately, this gives me the following error message:
Subscripted assignment dimension mismatch.
Error in construct_data (line 36) data9(i,9) = moneyness;
IS there anybody who can help me?
댓글 수: 0
채택된 답변
James Tursa
2013년 4월 10일
Did you mean this?
data9(:,9) = moneyness;
Another way to do it:
data9 = [data8 moneyness];
참고 항목
카테고리
Help Center 및 File Exchange에서 Import, Export, and Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!