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

采纳的回答

Walter Roberson
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 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by