Find the mean of each consecutive pair of numbers in the input row vector. For example,
x=[1 2 3] ----> y = [1.5 2.5]
x=[100 0 0 0 100] ----> y = [50 0 0 50]
I added another test to the suite that invalidated this cheesy solution.
Why is eval forbidden while regexp isn't? Don't they have the same 'nature'?
It seems that the vast majority of leading solutions are size 10 or 11. If a problem has a single output, then having a return argument of 'ans' makes the size smaller. For instance:
is smaller in size than
m = mean([x y])
This seems silly, and makes me think that there is some 'trick' to these size 10&11 solutions that has little to do with good coding practices. Of course, it could just be sour grapes on my part because I can't get my sizes even close to that small.
The Hitchhiker's Guide to MATLAB
Back to basics 5 - Clipboard
Change the sign of even index entries of the reversed vector
Generate a random matrix A of (1,-1)
04 - Scalar Equations 1
Is my wife right?
Is my wife right? Now with even more wrong husband
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office