File Exchange

image thumbnail

to generate 16 combination of 1 and -1

version 1.0 (1.06 KB) by

16 different combination of 1 and -1

0 Downloads

Updated

View License

16 different combination of 1 and -1

Comments and Ratings (2)

John D'Errico

John D'Errico (view profile)

Wow. This is seriously bad, convoluted code, to do what can be done in one short line.

2*(dec2bin(0:15) - '0')'-1

As Stephen points out, no help. Essentially no comments. No clue. I had to laugh at one of the very few comments in the entire code...

%while (count<=j-1)

Yep. Not a comment at all, just some deadwood from when the author was writing the code.

No help, no comments, no explanation, no examples, no description, no clue as to what this code actually does.

Poor MATLAB code: multiple loops with if and break statements, which is just calling out to be vectorized:

http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html

MATLAB Release
MATLAB 8.4 (R2014b)
Tags Add Tags
Acknowledgements

Inspired by: SnagIt, MatScat

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video