I keep receiving 'Matrix dimensions must agree' when using c(c==-d)... it seems to work fine in matlab, but not on here. Any ideas?
Note that "c(c==-d) = d" means that c and d must be same size or d is scalar. Moreover if d is not a scalar, then all "c==-d" must be true. This code seems to work in rare case, when one value is negative real number, and the rest are positive real numbers, but I have not tested it.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
j = sqrt(-1);
z = [-4 6 3+4*j 1+j 0];
zSorted_correct = [6 3+4*j -4 1+j 0];
assert(isequal(complexSort(z),zSorted_correct))
|
2 | Fail |
z = 1:10;
zSorted_correct = 10:-1:1;
assert(isequal(complexSort(z),zSorted_correct))
|
1594 Solvers
244 Solvers
Back to basics 11 - Max Integer
611 Solvers
191 Solvers
07 - Common functions and indexing 6
282 Solvers