Put two time series onto the same time basis
Use interpolation to align two time series onto the same time vector. This is a problem that comes up in <http://www.mathwork...

1年以上 前

Construct an index vector from two input vectors in vectorized fashion
Create an index vector defined by two input vectors, one defining the beginnings of one or more index ranges, and the other defi...

1年以上 前

Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

1年以上 前

letter yes yes & letter no no
Split a string into two strings, wherein the first string has all alphabetic letters and the second string has all the remaining...

1年以上 前

Convert a structure into a string
Convert the contents of each fields into a string. Example with an input structure s with 2 fields : s.age = '33' s....

1年以上 前

Natural numbers in string form
Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be. Ex...

1年以上 前

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

1年以上 前

Remove element(s) from cell array
You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

1年以上 前

Reverse within string
If input is a string 'yellow' the output should be 'leywol'. Locate the middle of the string and reverse the first (yel) and sec...

1年以上 前

Decimation - Optimized for speed
This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will b...

Decimation
When dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and...

Max index of 3D array
Given a three dimensional array M(m,n,p) write a code that finds the three coordinates x,y,z of the Maximum value. Example ...

Find last zero for each column
Given a numeric array of arbitrary size, return the row index of the last zero for each column. If a column contains all nonzero...

Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

find "greatest common divisor" of two integer value
A function to find Greatest Common Divisor of two integer input E.G. x=-18 y=96 output should be +6 x=-18; y=96; >>your...

Replace 0 indices in array with 1's
Take a incoming vector, and replace 0's with ones

Finding two missing number in 1 to n array
You are given an array of numbers from 1 to n with two missing numbers. Return the two missing numbers. Input: x=[5 2 0 1 ...

Replace x value into y value in string text.
Replace x value into y value in string text. Example text='Hello World' x='World', y='Universe' result='Hello Universe'.

Vector Element Multiplication
Take two incoming vectors, and output the element wise multiplication of the vectors.

Low level NaN
* I have a dataset. Columns represents different variables. * A variable may start with NaN or any double type number. * If i...

Reverse digits of a number
Reverse digits of a number. For example, return *321* for the input *123* . The left-hand zeros can be discarded. For exam...

Find max prime number
Given integer number n. Find the max prime number (mpn) that smaller than or equal to n. Example: n = 10 --> mpn = 7

Add only the odd numbers of x example: x = [1 2 3 4 5] the positive numbers are: 1 3 5, so their sum is 9

intervals
Write a function that takes an interval from a to b, and divides it into 6 parts.

is the number happy?
test is a given integer number is Happy of not? answer 1 if yes or 0 is no

Encode Me From The Past
Given this input x = 2, 5, 1, 2, 4, 1, 1, 3 output should be (Five 2's, Two 1's, One 4, Three 1's) [2 2 2 2 2 1 1 4 1...

Find the outcast
All pairs have the same difference except for one. Output the index of the latter Example: input =[0 1; 1 0; ...

Calculate the logarithm of number
Calculate the logarithm of number x

Find Missing Number
A little problem (inspired by CodeChef) for the coffee break. A friend give you an array of size n-1 integers and these int...

Odd elimination
Inspired by Project Euler problem #539 You'll be given a vector from 1 to n; Going from left to right, remove the first n...