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
Test cases with an empty result now test against isempty().
I think the Test Suite is broken for the results requiring an empty vector. Even though my function returns [ ] it is not detected as correct, as isequal() returns 0.
solving is easy, solving effectively is not! nice problem :)
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.
Make the vector [1 2 3 4 5 6 7 8 9 10]
Find the maximum number of decimal places in a set of numbers
Insert zeros into vector
03 - Matrix Variables 4
Plot Damped Sinusoid
Return the largest number that is adjacent to a zero
Swap the first and last columns
Remove the vowels
Find the treasures in MATLAB Central and discover how the community can help you!
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