What does this piece of psuedocode mean?
1 次查看(过去 30 天)
显示 更早的评论
Hello there, I was given psuedocode to implement into MATLAB, but i'm having a bit of trouble with this portion. Here is what it looks like, but I cannot tell how to implement what it's asking for in MATLAB. Can someone tell me what it means in code?
0 个评论
回答(1 个)
KSSV
2017-11-1
G = round(rand(10)) ;
% sum of columns
sumG = sum(G,1) ;
% select s
s = sumG(randsample(10,1)) ;
% get c (column whose sum of columns is equal to c)
c = find(sumG==s) ;
% get r (zero's in the c column)
r = find(G(:,c)==0)
1 个评论
Stephen23
2017-11-1
Notes:
- rather than round(rand(10)), simply use randi.
- find is not required, linear indexing is more efficient.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!