Specific Element Count
Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_.
Note: NaNs are equal and there may be n...
25日 前
解決済み
Return unique values without sorting
If the input vector A is [42 1 1],
the output value B must be the unique values [42 1]
The *values of B are in the s...
25日 前
解決済み
Remove the two elements next to NaN value
The aim is to *remove the two elements next to NaN values* inside a vector.
For example:
x = [6 10 5 8 9 NaN 23 9 7 3 21 ...
25日 前
解決済み
Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have
a = [1 2 2 2 1 ...
25日 前
解決済み
First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...
25日 前
解決済み
Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0.
a = 3;
b = [1,2,4];
Returns 0.
a = 3;
b = [1,...
Solve a Weird Calculator puzzle
The September 2012 issue of GAMES Magazine had a Weird Calculator puzzle by Erich Friedman. In this puzzle, the calculator has o...
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.