i want to use nchoosek command in FOR loop in decreasing order for decoding process, it works in increasing order in FOR loop for encoding , Any suggestions
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Junaid Khan
am 10 Nov. 2016
Kommentiert: Junaid Khan
am 10 Nov. 2016
m=4;
r=4;
%%%%%%%%%%%%%%%%%%%
for a=r:2
v=1:1:m;
% Making combinations in decreasing order, but it is not working
c = nchoosek(v, a);
end
0 Kommentare
Akzeptierte Antwort
Guillaume
am 10 Nov. 2016
When you write a:b, matlab generates all numbers from a (included) to b (maybe included) in increments of +1. If b is smaller than one, no number is generated
If you want a different step than the default +1 you have to specify it explicitly. a:step|b, so:
for a = r:-1:2
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!