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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Search Activities

Jan Orwat submitted a Comment to Problem 42272. Return multiple values function

Hello Martin, I think you should ask this question on MATLAB Answers, not Cody.
http://nl.mathworks.com/matlabcentral/about/cody/
http://nl.mathworks.com/matlabcentral/about/answers/

4 hours and 3 minutes ago

Jan Orwat submitted a Comment to Problem 42265. Test if a number is numeric or not

What is the purpose of problem like this?

4 hours and 15 minutes ago

Jean-Marie SAINTHILLIER submitted a Comment to Problem 42257. create square matrix of stars.Given z where rows and columns equal to max of z

?

4 hours and 56 minutes ago

bainhome submitted a Comment to Problem 42255. Volume of Cylinder

indeed,why don't you use pi?

on 25 Apr 2015 at 14:33

Jan Orwat submitted a Comment to Problem 3095. Return fibonacci sequence do not use loop and condition version 2

have fun!

on 25 Apr 2015 at 9:48

Martin Vinstrup submitted a Comment to Solution 660383

It only work for one x and y. I need, so It can work with a coloum with x and y :)

on 25 Apr 2015 at 6:37

M.C. submitted a Comment to Problem 3095. Return fibonacci sequence do not use loop and condition version 2

Ok, I see - I'm not allowed to use ^. The list of banned functions seems much more restrictive than not using a for or a conditional. Back to the drawing board!

on 24 Apr 2015 at 22:07

M.C. submitted a Comment to Problem 3095. Return fibonacci sequence do not use loop and condition version 2

Thanks Jan. I would have expected to receive the message "No fancy functions!" if was using something I shouldn't be. Here is my solution (which works in my matlab and doesn't appear to have anything "illegal"):
function y = fib(x)
[v,d] = eig([1 1; 1 0]);
M = v*bsxfun(@times, [d(1,1).^(x-1);d(2,2).^(x-1)], v\[1;1]);
y = uint8(M(2,:));
end

on 24 Apr 2015 at 17:52

Niels submitted a Comment to Solution 659973

Should work for any case and doesn't contain str2num or regexp :)

on 24 Apr 2015 at 10:31

Sergej Pauli submitted a Comment to Problem 106. Weighted average

this is not really the weighted average, because of 10 15 and 20 the average can't never be 33.333 here is a bug

on 24 Apr 2015 at 9:37

Ziko submitted a Comment to Problem 42255. Volume of Cylinder

test suite 1 is wrong
what are you using for pi?

on 24 Apr 2015 at 9:19

Sergej Pauli submitted a Comment to Problem 12. Fibonacci sequence

fibonacci, a math out of gods creation

on 24 Apr 2015 at 9:08

Jan Orwat submitted a Comment to Problem 3095. Return fibonacci sequence do not use loop and condition version 2

Hi M.C., in this problem some of the functions are banned by author. This cause "standard" solutions known from previous fibonacci numbers related problems to fail. Examine your code against functions and operators listed in 1st test.

on 23 Apr 2015 at 19:11

M.C. submitted a Comment to Problem 3095. Return fibonacci sequence do not use loop and condition version 2

For some reason, I keep getting test suite errors:
L 3 (C 29-33): Invalid syntax at 'error'. Possibly, a ), }, or ] is missing. L 3 (C 29-33): Invalid syntax at 'error'. Possibly, a ), }, or ] is missing.

on 23 Apr 2015 at 18:27

Gareth Lee submitted a Comment to Problem 246. Project Euler: Problem 8, Find largest product in a large string of numbers

your problem need the result is: 'The large number will be given as a string, 1xn characters.', but your test suits given is double

on 23 Apr 2015 at 0:19

Andrew Stamps submitted a Comment to Problem 42083. Ring Matrix

Looks like the test suite could use some work.

on 22 Apr 2015 at 19:49

Gareth Lee submitted a Comment to Problem 360. peta to nano (x-ray)

it seems the test result is centimeter, not nanometer

on 22 Apr 2015 at 5:26

Nicholas Hind submitted a Comment to Problem 7. Column Removal

why isn't B = (A(:,n)=[]); working? thanks

on 21 Apr 2015 at 3:07

Pinakin submitted a Comment to Solution 578511

hello brian !
I'd like to know how your solution size is 9.
Can you please let me know how you did it ?
Thanks !

on 20 Apr 2015 at 9:22

Pinakin submitted a Comment to Solution 296653

hello Alfonso !
I'd like to know how the solution size for your solution to the 'times two' question is '0'
can you please explain ?
thanks !

on 20 Apr 2015 at 6:00

Paul Berglund submitted a Comment to Problem 8071. summation of the reciprocals

An interesting follow-up problem would be multi-digit values for K.

on 19 Apr 2015 at 16:32

Clark Grismond submitted a Comment to Solution 472008

Can you please send me your code for this??? Really struggling on this for a school assignment clarkieg123@gmail.com

on 18 Apr 2015 at 23:15

Clark Grismond submitted a Comment to Solution 186443

on 18 Apr 2015 at 23:14

Clark Grismond submitted a Comment to Solution 185908

on 18 Apr 2015 at 23:14

Gareth Lee submitted a Comment to Problem 762. Matrix which contains the values of an other matrix A at the given locations.

agree! it is easy to cheat!

on 18 Apr 2015 at 11:18

bainhome submitted a Comment to Solution 654037

"Recursion" in title had me in a really tricky detour.

on 16 Apr 2015 at 17:04

bainhome submitted a Comment to Solution 654037

cheat this one because I think my answer wasn't wrong despite the stupidity, wonder if why this insanely slow.

on 16 Apr 2015 at 16:40

Aaron submitted a Comment to Solution 289586

Test suite answers need to be /60 and are in watts, not kW.

on 16 Apr 2015 at 14:06

Richard Zapor submitted a Comment to Solution 205929

Test Suite check will be fixed. Thank you for pointing out my omission of abs.

on 19 Feb 2013

Tim submitted a Comment to Problem 1277. How many days does the cat take to climb out of the hole?

There are also the feelings of the cat to consider--whether it is fair to force him to spend an extra day undergoing an experiment of questionable benefit to science (and no obvious benefit to cats).

on 19 Feb 2013

Richard Zapor submitted a Comment to Solution 205631

New variable " balls" vs prior ball. ball(2) would find the x position of the second ball. balls(5) would find y of second ball.

on 19 Feb 2013

Bruce Raine submitted a Comment to Problem 1277. How many days does the cat take to climb out of the hole?

Hi RIchard, sorry if my conditions are a bit restrictive and you are quite clever to have realised it could be a day earlier for those test cases. Perhaps my problem is unnecessarily restrictive so if others feel the same I will revise it. :)

on 19 Feb 2013

Tony submitted a Comment to Solution 116870

I dont get whay sort(unique(ix)) will give you the location of the two points. it is wrong for these points (0.9631 0.5468),(0.5211 0.2316),(0.4889,0.6241),(0.6791 0.3955),(0.3670 0.9890),
sort(unique(ix)) will return [1 2 5].

on 18 Feb 2013

Vitaly Lavrukhin submitted a Comment to Solution 201974

Thank you, Christopher! Sometimes Python comes in handy.

on 18 Feb 2013

Rhys submitted a Comment to Problem 158. Is my wife right? Now with even more wrong husband

This is a brilliant question!

on 18 Feb 2013

Bruce Raine submitted a Comment to Problem 1277. How many days does the cat take to climb out of the hole?

I stand by my test case answers for 3 and 4 as the cat must be clear or above the hole to escape.

on 17 Feb 2013

Richard Zapor submitted a Comment to Problem 1277. How many days does the cat take to climb out of the hole?

My cat gets out 1 day earlier on cases 3 and 4, by a claw. He reaches 25 on day 20.

on 17 Feb 2013

Alfonso Nieto-Castanon submitted a Comment to Solution 189786

Nice way to minimize number of queries!

on 17 Feb 2013

Richard Zapor submitted a Comment to Solution 204897

A masterful optimal solution that pre-positions the paddle for minimal movement to return the next ball.

on 17 Feb 2013

Rahul Kalampattel submitted a Comment to Problem 167. Pizza!

Lol, very nicely done :)

on 17 Feb 2013

James submitted a Comment to Problem 1260. RISK board game battle simulation

I didn't submit a solution yet...mainly because I couldn't match up your test values and wanted to make sure that the problem wasn't on my end. (Most of the time, it is! :-)

on 12 Feb 2013