Pedro - MATLAB Cody - MATLAB Central

Pedro

15153
Rank
4
Badges
330
Score
1 – 50 of 65

Pedro received Leader badge for Solution 227089

on 2 Feb 2023

Pedro submitted a Comment to Solution 237221

Hi, Florent. The scoring in Cody is based on the number of nodes in the parse tree, and strings only require one node. You can have a look for yourself by typing: '>> mtree('back_and_forth.m','-file').show'. Try to do it for the same code, without str2num, and you'll see that even small things like parenthesis or plus signs require their own node in the tree. In terms of performance, the two versions are not so different. The problem here is that every solution, that use str2num in this way, will have the same Cody score, regardless of how elegant or efficient the anonymous function is.

on 23 May 2013

Pedro submitted a Comment to Solution 226226

That would be something, wouldn't it? The mistake was copy-pasting this version, with the [1 1]s, instead of a version without them. They are not needed, as you noticed.

on 16 May 2013

Pedro submitted a Comment to Solution 226226

Hi, Heather. To be honest, this was an older version that I was using to test containers.Map, and ended up submitting by mistake.

on 14 May 2013

Pedro submitted a Comment to Solution 237221

Sorry for the nasty solution. I'm hoping the use of str2num and anonymous functions will eventually be limited, since most simple problems can be solved with this cheat.

on 28 Apr 2013

Pedro received Commenter badge for Solution 237221

on 28 Apr 2013

Pedro liked Solution 112159

on 4 Apr 2013

Pedro liked Solution 207558

on 4 Apr 2013

Pedro received Promoter badge for Solution 103915

on 29 Mar 2013

Pedro liked Solution 103915

on 29 Mar 2013

Pedro submitted Solution 225406 to Problem 5. Triangle Numbers

on 29 Mar 2013

Pedro submitted Solution 225405 to Problem 7. Column Removal

on 29 Mar 2013

Pedro submitted Solution 225378 to Problem 7. Column Removal

on 29 Mar 2013

1 – 50 of 65
Go to top of page