File Exchange

image thumbnail

to generate 16 combination of 1 and -1

version 1.0.0.0 (1.06 KB) by vikrant chib
16 different combination of 1 and -1

0 Downloads

Updated 05 Mar 2015

View License

16 different combination of 1 and -1

Comments and Ratings (2)

John D'Errico

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 Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired by: MatScat, SnagIt

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor