Solved


Given two strings, find the maximum overlap
Given two strings s1 and s2, create a new string s3 which is as short as possible and contains both strings. If s1 = [1 2...

14 years ago

Solved


Is my wife right?
Regardless of input, output the string 'yes'.

14 years ago

Answered
Creating matrix of maximum values from multiple dimension matrix
[a,b]=max(A) n = size(a); B = a(sub2ind(n,ones(n),b,repmat(reshape(1:n(3),1,1,[]),1,n(2))));

14 years ago | 1

| accepted

Solved


Compute the dilation of a binary image
A basic operation in image analysis is the dilation. Given an image where each pixel is either on or off (black/white, true/fals...

14 years ago

Solved


Multiply 2 numbers
Very easy, you just have to multiply 2 numbers but you cannot use the following signs (*, /, - ,^) ,mtimes , times, cross, pro...

14 years ago

Answered
round floating numbers in matlab
x = .231; round(x*10)/10;

14 years ago | 0

Solved


Find state names that end with the letter A
Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

14 years ago

Answered
reshaping a vector of dates (2)
g = regexp(AAA,'(^\w)|(-\w)|( \d*)','match'); AAA = strrep(cellstr(cell2mat(cat(1,g{:}))),'-',''); EDIT

14 years ago | 0

| accepted

Solved


Longest Divisor Run
Given the vector a, find the longest run of consecutive numbers that can be evenly divided by the same number d where d > 1. ...

14 years ago

Answered
calculate the correlation of a number of time series
R = arrayfun(@(x)nonzeros(tril(corrcoef(data(:,x),mean(data(:,setdiff(1:size(data,2),x))')'),-1)),1:size(data,2)); or ...

14 years ago | 0

| accepted

Answered
Data extraction from a text file.
f = fopen('yourtextfile.txt'); c = textscan(f,'%s'); fclose(f); out = str2double(c{:}(1:2:end));

14 years ago | 0

Answered
Deleting [ ] from a matrix
d ={'gene1' [] 'u' 'u' 'd' 'gene2' 'u' 'u' [] 'u' 'gene3' [] 'u' 'd' [] 'gene4'...

14 years ago | 0

| accepted

Solved


Make a run-length companion vector
Given a vector x, return a vector r that indicates the run length of any value in x. Each element in r shows how many times the ...

14 years ago

Solved


Alphabetize by last name
Given a list of names in a cell array, sort the list by the last name. So if list = {'Barney Google','Snuffy Smith','Dagwood ...

14 years ago

Solved


Given a window, how many subsets of a vector sum positive
Given a vector: [1 0 -1 3 2 -3 1] and a window of 2, A sliding window would find: 1 + 0 = 1 0 - 1 = -1 ...

14 years ago

Solved


Flag largest magnitude swings as they occur
You have a phenomenon that produces strictly positive or negative results. delta = [1 -3 4 2 -1 6 -2 -7]; Marching thr...

14 years ago

Solved


Find a subset that divides the vector into equal halves
Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

14 years ago

Solved


Spot the outlier
All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

14 years ago

Solved


How long is the longest prime diagonal?
Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

14 years ago

Solved


Find the biggest empty box
You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

14 years ago

Answered
Need help with a While loop
switch N case {3,4} X = abs(PV(N) - PV(N-1)); Y = abs(PV(N-1) - PV(N-2)); end OR k...

14 years ago | 0

Solved


Determine Whether an array is empty
Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

14 years ago

Solved


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,...

14 years ago

Solved


Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

14 years ago

Solved


Convert a vector into a number
This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

14 years ago

Solved


Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

14 years ago

Solved


Read a column of numbers and interpolate missing data
Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

14 years ago

Solved


Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

14 years ago

Solved


Remove the polynomials that have positive real elements of their roots.
The characteristic equation for a dynamic system is a polynomial whose roots indicate its behavior. If any of the <http://www.ma...

14 years ago

Solved


Find the two most distant points
Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

14 years ago

Load more