i think the question may be worded incorrectly. there is no adding
Exact . Thanks for the remark , I replaced the "add" word by "remove"
Problem name “Remove the two elements next to NaN value” is confusing. In a 1d array the first and last element have 1 element next to them while other elements have 2 elements next to them. The name would imply that we are to remove one element preceding and one element following a NaN however in the problem description we are told to remove the two elements following the NaN. I would argue that the element preceding the NaN is more “next to” the NaN than the element two elements away. Name should be changed to “Remove the two elements following a NaN value”.
The term "next to NaN" would generally be considered as the one right before and the one right after NaN, if existing. Also the problem failed to say that NaN themselves need to be removed.
JF & LD, I agree with both of your comments. Furthermore, it is unfortunate that in the example the first NaN has digit "9" both immediately preceding it and two elements after it, making the procedure to get the result in that neighbourhood ambiguous.
not so easy problem. Took a lot of time for thinking!
middleAsColumn: Return all but first and last element as a column vector
Getting logical indexes
Are all the three given point in the same line?
Symmetry of vector
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
Combinations without using nchoosek
Number of bytes required to store a sparse matrix
Cody Computer Part 2 - Get the license number of Cody Computer
Angle between two vectors
Cody Computer Part 1 - Guess the system font used by uipanel
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