Any version of "empty" should be acceptable as correct.
For example, intersect can output a 1x0 empty matrix. That should be allowed.
Somehow the assert is triggered if the function returns a  that has been "sorted".
If I include that code
y = sort(unique(y));
no assert is triggered. Seem strange!
How can the leading solution be 0??
Following many comments, the Test Suite should be amended to check for an empty output vector using "isempty", rather testing for equality to . Such an amendment is appropriate, and would not break any of the previously submitted successful solutions. —DIV
This is far from elegant, but works! Is there a a vectorised way to approach this in a much more efficient way?
function y = common_by_row(x)
Why doesn't this work?? :( it returns an empty array as I specified...
Why is this incorrect? It's failing when the output is = ;
In matlab, I'm getting output as:
1×0 empty double row vector
Is that not the same thing?
My code is correct but it is showing not a solution.......help me
The fact that an empty 0-by-1 matrix does not equal  is a bit offputting.
I had to add an extra if-clause because the assertion isn't particularly forgiving about its definition of an "empty matrix".
The test suite should consider a 0x0 empty matrix (as given by y = ) as equivalent to a 1x0 empty matrix (which results from the code above it
solution uses recursion
argh! trying to debug third test case. I am returning a . assert is comparing that to a . How do I fail?
Both 3rd test case and 5th evaluate to  locally, but I fail the cody asserts.
As others have later commented, the assert requires a 0×0 size 'empty' vector. See edited version in Solution 1276044.
Who Has the Most Change?
Number of 1s in a binary string
Angle between Two Vectors
Sum the Digits of a Number
02 - Vector Variables 2
Find the two-word state names
Indexed Probability Table
Determine if input is odd
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office