Please explain me on Attempted to access C_copy(1,:);
1 次查看(过去 30 天)
显示 更早的评论
N_UE=[10 20 30 40 50];
N_SC=[60 70 80 90 100];
C=rand(N_UE(t),N_SC(r));
C_copy = C;
sz=length(C_copy(1,:))
Attempted to access C_copy(1,:); index out of bounds because size(C_copy)=[0,100].
why I am getting Attempted to access C_copy(1,:); could anyone explain on this
0 个评论
采纳的回答
Walter Roberson
2017-12-29
Your C_copy has become empty. C_copy(1,:) does not exist to take the length() of. You should not have been using length() at all there: you should be using
sz = size(C_copy, 2);
However I would suggest to you that you have a bug there and that you should instead have been using
sz = length(C_copy(:,1))
the better version of which would be
sz = size(C_copy, 1)
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!