Can you explain the last line of your code please. It's very strange... I have the feeling it could be the solution of the different get_me problems.
sorry, I was just testing this idea here (cody only displays the output of disp if your code 'passes' a test, so I used the first two lines to 'pass the test', and the last line just to test whether the 'disp' bit would be evaluated or not, which it did, so that ended up being the delivery method for my get_me v4 solution http://www.mathworks.com/matlabcentral/cody/problems/1752-get-me-v4-cody-hacking-challenge/solutions/290694)
Thank you. So it's possible to execute commands in the base workspace AFTER the end of the function ?
This is just equivalent to evalin('base', str), str is being executed in matlab workspace (but not after the end of the function, perhaps you can combine this with a timer object for that?), what makes this trick interesting is that it is difficult to have it blocked since there are a lot of similar variants that would work just the same while using different matlab objects/functions (sorry that i am being a bit vague, i prefer not to give away the solution in the comments so that i do not spoil the fun for others :)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
get = me();
y = rand(1,12345);
!rm now.m
!rm assert.m
assert(get == now)
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In me at 2
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode at 122
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode at 147
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode at 173
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode>pcodefile at 245
In pcode at 217
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.p has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode>pcodefile at 245
In pcode at 217
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode at 223
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.p has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In pcode at 223
In me at 3
In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
tal
rm: cannot remove `now.m': No such file or directory
[Warning: Function /users/msssystem1/assert.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.p has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
[Warning: Function /users/msssystem1/assert.p has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In verifyCode>evaluateCode at 227
In verifyCode at 40
In fevalJSON at 14
In workspacefunc at 7]
|
19334 Solvers
1421 Solvers
Project Euler: Problem 1, Multiples of 3 and 5
1492 Solvers
Project Euler: Problem 6, Natural numbers, squares and sums.
1018 Solvers
5004 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!