Problem 42854. Crunch that matrix!
Solution Stats
Problem Comments
Solution Comments
-
8 Comments
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!
-
1 Comment
conv never die. nice one!
-
5 Comments
Problem Recent Solvers80
Suggested Problems
-
1367 Solvers
-
Find state names that start with the letter N
1037 Solvers
-
Getting the indices from a vector
7083 Solvers
-
Given a window, how many subsets of a vector sum positive
832 Solvers
-
5424 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!