can someone help with this? i dont understand the error message : "Error using SharedVariable1". Thanks
It's not just you. I just tried submitting this solution, and got the same error. Since your line 3 is blank, it probably has something to do with the Cody side of things...
The "line 3" in the error message is actually line 3 in the test suite, rather than the line in your code. I just got a similar error on another Cody problem. "Error using VisibleTest1 (line 4)"
I tested this solution on my own computer, and I got an error which is indeed caused by the floating-points error because the first 3 test cases are checking exact equality by isequal. Thus, simply change your line 5 into "a=filter(ones(1,3),1,x(i,:));" or use an additional round (e.g., a = round(a,10);) should be able to fix the floating-point error as well as this Cody error ("Error using VisibleTest1").
It seems there exist some interference between testing/scoring Cody code, slightly faulty test suite and failing solution. See also solutions 894929 and 894930. This problem has currently 5 tests, but first test begins with "%%a" which comments out first line but it somehow completely disables the display of it and after submission there are only 4 tests shown. On the other hand this solution fails tests 1 and 2 (in original test suite, here is only 2nd shown, under position 1) due to the numeric precision issues (missing tolerance test in tests). What is more interesting the "add problem" page seems to have different version of Cody testing engine and looks more accurate. Anyway, it looks like the error from the first test is copied to the rest. Last three tests should be correct. I expect everything behave correctly after adding newline sign, and tolerance tests in the test suite.
I went in to edit the test suite, and there are no percent signs at the start of the first test suite. When I look in the "Solve This Now!" section, there is. That's strange. I'll add in the new line, rescore, and see how that works.
Looks like it works now.
I had to put in a %% in the first line of the test suite to get everything working. I also added in a tolerance of 1e-10 on all of the test suites, rather than just ones with non-integer values, for those of you who were smart enough to use the filter command. Great detective work, Peng and Jan!
conv never die. nice one!
I am extremely envious that you have R2016a, Binbin.
Good hint, James!
ouch!that hurts dude...
Welcome back, bainhome
Make a run-length companion vector
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
Compare two input matrices
Replace Nonzero Numbers with 1
Rewrite setdiff to account for non-unique values
A matrix of extroverts
Accessing values in a cell
I've got the power! (Inspired by Project Euler problem 29)
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