Solved


Better bullseye matrix
<http://www.mathworks.com/matlabcentral/cody/problems/18-bullseye-matrix Problem 18> asks to create a bullseye matrix like this:...

4 years ago

Solved


Combine Data With Gaps
Combine data sets a and b where the datasets have "gaps" or unique points. Example: Input a = [1,0; 2,1; ...

4 years ago

Solved


How close to a hole
Suppose you have a description of good places (ones) and bad places (zeros). You want to know your distance from a bad place (in...

4 years ago

Solved


Split array into pieces according to corresponding array
An array x of length n has values 1...m with each value appearing at least once. The values are sorted (n>=m). A second...

4 years ago

Solved


Find the same and successive values in a vector
Find the same and successive values in a vector. For example: Input x = [ 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 ] Start and end...

4 years ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

4 years ago

Solved


Return the first and last character of a string
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

4 years ago

Solved


Find the distance between runs
Another question inspired by the <http://uk.mathworks.com/matlabcentral/answers/?s_tid=gn_mlc_an answers forum>: A vector of ...

4 years ago

Solved


Look Up Mapping
Let the input is A = {[] [] [] [1] []}; B = {'A','B','C','D','E'}; Mapped Output = 'D';

4 years ago

Solved


Assignment Problem
Given a matrix where row i corresponds to person i, and column j corresponds to task j and cell (i,j) corresponds to the time ta...

4 years ago

Solved


Find longest run
Write a function longest_run that takes as input an array of 0's and 1's and outputs the length and index of the longest consecu...

4 years ago

Solved


Add two numbers
Given a and b, return the sum a+b in c.

4 years ago

Solved


Check if a rotated array was originally sorted
Suppose a sorted array is rotated at some pivot unknown to you. For example, |[0 1 2 4 5 6 7]| might become |[5 6 7 0 1 2 4]|. ...

4 years ago

Solved


Weave two matrices together to form one matrix
Take the first column from matrix a, then insert the first column from matrix b, and so on. For example: a = [1 2 3 4]; b ...

4 years ago

Solved


Zero Cross
Write a function that counts the number of times n a signal x changes sign. Examples x = [1 2 -3 -4 5 6 -7 8 -9 10 11] ...

4 years ago

Solved


generate number in particular way
A = [1 5 2 7]; MAX = 10; generate a array Y = [1 2 2 2 2 2 3 3 4 4]; i.e. total eleme...

4 years ago

Solved


S-T-R-E-T-C-H I-T O-U-T
You will be given a row of numbers (x), and a single number (n). Your job is to write a script that will stretch out the row of...

4 years ago

Solved


Find the sum of the elements in the "second" diagonal
Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

4 years ago

Solved


Replace Nonzero Numbers with 1
Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

4 years ago

Solved


Find Elements in Range
Based on a question on <http://www.mathworks.com/matlabcentral/answers/ MATLAB Answers>. Find all the elements of a vector wh...

4 years ago

Solved


Find indices of diagonal elements
Given a matrix A and a diagonal index d (where 0 indicates the main diagonal and off-diagonals are identified by positive and n...

4 years ago

Solved


longest sequence of nans
In an array return the length of longest sequence of nans for each column. x = [ 2 3 1 2 5 6; nan nan 5 n...

4 years ago

Solved


Matrix multiplication across rows
Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix Example ...

4 years ago

Solved


Too Many Zeros, Dump Them!
Sometimes when I create a matrix, I use this syntax: a = zeros(1000,1000); But when the function ends, I find that I don'...

4 years ago

Solved


subtract central cross
Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.

4 years ago

Solved


Write a function man that takes a row vector v and returns a matrix H as follows..
Write a function called man that takes a row vector v as an input and returns a matrix H whose first column consist of the eleme...

4 years ago

Solved


frame of the matrix
Given the matrix M, return M without the external frame.

4 years ago

Solved


Perimeter of a semicircle
Given the diameter d, find the perimeter of a semicircle

4 years ago

Solved


Pi Digit Probability
Assume that the next digit of pi constant is determined by the historical digit distribution. What is the probability of next di...

4 years ago

Solved


Index one element in each vector of an array along a given dimension
Functions like min and max can return in their second output argument the index of the element in each vector along a particular...

4 years ago

Load more