Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Recent Activity

Shayan Majidy submitted a Comment to Solution 897995

Lists all of them.

on 28 May 2016 at 19:56

Francisco submitted a Comment to Solution 897799

It's so easy! I would prefer some problems that require special indexing functions, such as colon, end, sub2ind or ind2sub.

on 28 May 2016 at 9:32

Francisco submitted a Comment to Solution 897667

I'll try to improve it!

on 27 May 2016 at 23:06

Tom Purcell submitted a Comment to Solution 897471

Yay, 10 msec! Any way to compare solutions by timing performance?

on 27 May 2016 at 21:35

HH submitted a Comment to Problem 42839. Identify the sequence

Test case 11 fixed. Thanks.

on 27 May 2016 at 18:43

Rathin Joshi submitted a Comment to Problem 42801. means

Wrong Solution for Test Case 3. Value of Harmonic Mean and Geometric mean are not the value which should come. Please change

on 27 May 2016 at 9:31

Hao li submitted a Comment to Solution 712537

nice solution!

on 26 May 2016 at 9:12

Hanna Wells submitted a Comment to Solution 895656

This was nice

on 26 May 2016 at 0:28

Hanna Wells submitted a Comment to Solution 895553

This really saves time!

on 25 May 2016 at 23:20

Hanna Wells submitted a Comment to Solution 895551

This was a good problem/solution to start out on.

on 25 May 2016 at 23:18

Peng Liu submitted a Comment to Solution 891610

This conforms with my own experience, that is, a valid test suite should start with a separate line containing only %%, followed in the next line by the test code in each test case. For example, one may need to use the following format: %%(1st line of test 1) test case 1(2nd line), %%(1st line of test 2) test case 2(2nd line),...

on 25 May 2016 at 22:06

William submitted a Comment to Solution 895299

??? You're not allowed to have more than one NaN, but you can have as many 0's or 1's as you like? What, exactly, do you mean by 'unique'?

on 25 May 2016 at 14:09

James submitted a Comment to Solution 891610

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!

on 25 May 2016 at 12:13

Jan Orwat submitted a Comment to Solution 891610

Looks like it works now.

on 25 May 2016 at 12:09

James submitted a Comment to Solution 891610

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.

on 25 May 2016 at 12:02

James submitted a Comment to Solution 894741

*facepalm* Thank you. I feel like quite the idiot right now for not noticing that error.

on 25 May 2016 at 11:59

Jan Orwat submitted a Comment to Solution 891610

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.

on 24 May 2016 at 22:27

Peng Liu submitted a Comment to Solution 891610

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").

on 24 May 2016 at 22:14

Peng Liu submitted a Comment to Solution 891015

Welcome back, bainhome

on 24 May 2016 at 22:02

Peng Liu submitted a Comment to Solution 894741

To fix the "Error using VisibleTest1 (line 4)", could you change your first line as "function b = blkavg(A,subsz)"?

on 24 May 2016 at 21:40

James submitted a Comment to Solution 891610

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)"

on 24 May 2016 at 19:38

James submitted a Comment to Problem 42856. Block average

It's related to that problem in another way. I'm getting a similar error to Zikobrelli did: "Error using VisibleTest1 (line 4)"

on 24 May 2016 at 19:29

Daniel Pereira submitted a Comment to Problem 42560. Writing a while loop

I understand that the statement is wrong. It does not make sense to increment something untilit is less than 0. It should say "greater or equal than 0".

on 24 May 2016 at 14:46

Daniel Pereira submitted a Comment to Solution 894324

Shouldn't this work?

on 24 May 2016 at 14:22

J.R.! Menzinger submitted a Comment to Problem 42786. odd number odd sum

please check the test suite. You must call the function like this: your_fcn_name() *** without "x" ***

on 24 May 2016 at 8:39

Dennis Winston submitted a Comment to Solution 893867

Also should include other capitals

on 23 May 2016 at 17:50

Pim van der Sluis submitted a Comment to Solution 893708

This solution works.

on 23 May 2016 at 12:36

J.R.! Menzinger submitted a Comment to Solution 893618

Weak test suite. ;-)

on 23 May 2016 at 9:09

bainhome submitted a Comment to Solution 891015

ouch!that hurts dude...

on 23 May 2016 at 2:41

Steve submitted a Comment to Solution 893307

So compact! I didn't know about arrayfun and cellfun. Very useful functions.

on 22 May 2016 at 11:22

Steve submitted a Comment to Problem 42858. Block average ignoring NaN values

Thanks for the fun problem!

on 22 May 2016 at 10:29

Steve submitted a Comment to Solution 893288

Took a couple of tries, but I got it! :)

on 22 May 2016 at 10:29

Sa'di Altamimi submitted a Comment to Solution 892903

what about x = 1:10;

on 21 May 2016 at 20:18

Sa'di Altamimi submitted a Comment to Solution 892982

try: y=sum(1:2^x). It will lead to shorter solution.

on 21 May 2016 at 20:05

Christopher Cloo submitted a Comment to Solution 892759

in every other program language i have used, arrays are called with BRACKETS not parenthesis.

on 20 May 2016 at 22:20

Christopher Cloo submitted a Comment to Solution 892743

i had to add a line of code because you didnt expect the number to be a float rather then an integer so it counted my last test as wrong all because it had .000 at the end of each one.

on 20 May 2016 at 22:09

Binbin Qi submitted a Comment to Solution 891015

=^_^=, @James

on 20 May 2016 at 1:40

Katherine Harskamp submitted a Comment to Problem 42818. center of mass

The equation for center of mass is the sum of the mass*radius divided by the total mass, NOT the total distance (which is what seems to be the case for the test suite)

on 19 May 2016 at 15:46

Katherine Harskamp submitted a Comment to Problem 42818. center of mass

I agree with William. If I'm reading the problem correctly, then for the second test, there should be a mass of 1 at (0,0) and a mass of 2 at (1,1) which would put the center at (2/3,2/3).

on 19 May 2016 at 15:41

James submitted a Comment to Solution 891610

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...

on 19 May 2016 at 12:40

Zikobrelli submitted a Comment to Solution 891610

can someone help with this? i dont understand the error message : "Error using SharedVariable1". Thanks

on 19 May 2016 at 9:49

Jan Orwat submitted a Comment to Solution 891015

Good hint, James!

on 18 May 2016 at 14:26

James submitted a Comment to Solution 891015

I am extremely envious that you have R2016a, Binbin.

on 18 May 2016 at 14:00

Liu Jinbao submitted a Comment to Solution 891051

please don't use 'for...end'.It is recommended in matlab.

on 18 May 2016 at 9:33

William submitted a Comment to Solution 890683

The RMS is defined as the root-mean-squared deviation *from the mean*, not from zero ... so I think the whole test suite needs fixing.

on 17 May 2016 at 12:52

William submitted a Comment to Problem 190. Great Circle Distance

I agree. Polar angles are, by convention, measured from the pole, but in this problem you have to consider them to be measure from the equator if you wish to agree with the test cases.

on 14 May 2016 at 19:16

Richard Zapor submitted a Comment to Solution 889756

Tim created another superb solution. The highlights are an elegant center of square's determination using ndgrid. The crux of his method is a convolution for each square not using "same" with an interesting centroid kernel. The comparison between all square convolutions for all rotations utilizes a concise norm metric function. The method should work on non-binary images. The best six matches from the 180x180 upper triangle error array are handily converted into the output format. Thank You Tim for this elegant solution.

on 14 May 2016 at 16:02

bacetiner submitted a Comment to Solution 889552

I believe you can have a more efficient solution if you get rid of the intermediate variable A.

on 12 May 2016 at 21:25

Daniel E. Loza Morales submitted a Comment to Problem 1. Times 2 - START HERE

Easy starter problem. Except I was expecting Cody, to require a '.m' file upload.

on 12 May 2016 at 20:34

Michael Kobylarek submitted a Comment to Solution 889274

not sure why this is wrong.

on 12 May 2016 at 3:55