Dimension error in matrix manipulation
古いコメントを表示
Hi, trying to figure out why this doesn't work and how to make it work:-
looktime2= [1 16; 2 55; 2 61; 2 66; 2 68; 5 20; 6 60; 8 47; 8 83; 8 105; 9 72; 10 44; 10 57]
t2 = [true;diff(looktime2(:,1))~=0]; t2 = [t2,looktime2(:,2)];
t2 = [1 16; 1 55; 0 61; 0 66; 0 68; 1 20; 1 60; 1 47; 0 83; 0 105; 1 72; 1 44; 0 57]
Rmatrix is a 10 by 121 matrix
for i = 1:size(t2,1)
for j = 1
if t2(i,j)==1
sd(i,j) = Rmatrix(looktime2(i,j),1:t2(i,j+1));
end
if t2(i,j)==0
sd(i,j) = Rmatrix(looktime2(i,j),t2(i-1,j+1):t2(i,j+1));
end
end
end
When I press enter I get an Subscripted assignment dimension mismatch error , but I'm not sure how to get it to work.
Any help will be much appreciated. Thanks
2 件のコメント
Andrei Bobrov
2011 年 8 月 31 日
that want to get?
Andrei Bobrov
2011 年 8 月 31 日
error in the code
element double array assign vector
採用された回答
その他の回答 (1 件)
zohar
2011 年 8 月 31 日
Hi Amandeep,
This is the problem
sd(i,j) = Rmatrix(looktime2(i,j),1:t2(i,j+1));
Subscripted assignment dimension mismatch.
Rmatrix(looktime2(i,j),1:t2(i,j+1)) is vector , and sd(i,j) is 1x1 you can not do that.
Have fun
カテゴリ
ヘルプ センター および File Exchange で Financial Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!