Info

此问题已关闭。 请重新打开它进行编辑或回答。

Please help me to execute the following code as i am unable to get the exact result

1 次查看(过去 30 天)
UE=[2 4 6 8 10];
SC=[20 40 50 60 80];
for t=1:length(UE)
for r=1:length(SC)
G=rand(UE(t),SC(r));
siz = size(G)
B=zeros(siz);
N=2;
for g=1:N_SC(r)
C= B(:,g);
zeroidx = find(~C);
replaceidx = zeroidx(randperm(numel(zeroidx), N-sum(C)));
C(replaceidx) = 1 ;
S(:,g) = [C];
end
Z = G .* S
end
end
  1 个评论
Stephen23
Stephen23 2017-12-13
Duplicate:
https://www.mathworks.com/matlabcentral/answers/372581-could-anyone-help-me-to-execute-the-following-code-as-i-am-unable-to-get-the-result

回答(1 个)

Walter Roberson
Walter Roberson 2017-12-13
编辑:Walter Roberson 2017-12-13
N_SC is undefined, and we have no information about what it should be.
You included no comments about the purpose of the code, and your variable names are mostly not descriptive, and you did not include the error message.
You should assume that you will need to use the debugger to figure this out yourself because you are certainly not giving other people the information they need to assist you.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by