Solved

Summing Digits within Text

Given a string with text and digits, add all the numbers together. Examples: Input str = '4 and 20 blackbirds baked in a...

4 years ago

Solved

Tic Tac Toe FTW

Given a tic tac toe board: * 1 represents X * 0 represents empty. * -1 represents O It is X's move. If there is an imme...

4 years ago

Solved

Pattern matching

Given a matrix, m-by-n, find all the rows that have the same "increase, decrease, or stay same" pattern going across the columns...

4 years ago

Solved

The Goldbach Conjecture

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

4 years ago

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

4 years ago

Solved

Elapsed Time

Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

4 years ago

Solved

Encode Roman Numerals

Create a function taking a non-negative integer as its parameter and returning a string containing the Roman Numeral representat...

4 years ago

Solved

The Goldbach Conjecture, Part 2

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

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

4 years ago

Solved

Find the two-word state names

Given a list of states, remove all the states that have two-word names. If s1 = 'Alabama Montana North Carolina Vermont N...

4 years ago

Solved

Kaprekar Steps

6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

4 years ago

Solved

Vector creation

Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

4 years ago

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

4 years ago

Solved

Flip the vector from right to left

Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

4 years ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

4 years ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

4 years ago

Solved

Project Euler: Problem 2, Sum of even Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

4 years ago

Answered

snapshot problem in video processing

snapshot() is intended for use with a cameraboard object or webcam object and you are attempting you input an image object. You...

snapshot problem in video processing

snapshot() is intended for use with a cameraboard object or webcam object and you are attempting you input an image object. You...

4 years ago | 0

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

4 years ago

Answered

How to graph data in cells?

Your data has an empty cell in it so the first step here is to remove that ToBeGraphed(cellfun(@isempty,ToBeGraphed))=[]; % rem...

How to graph data in cells?

Your data has an empty cell in it so the first step here is to remove that ToBeGraphed(cellfun(@isempty,ToBeGraphed))=[]; % rem...

4 years ago | 0

| accepted

Answered

Extract subset of time-curves from a 4D volume

I can reduce this to a single for loop which iterates through the timesteps but i'm not sure about doing this entirely without l...

Extract subset of time-curves from a 4D volume

I can reduce this to a single for loop which iterates through the timesteps but i'm not sure about doing this entirely without l...

4 years ago | 0

| accepted

Answered

Sum of elements in an array over x

a = [0.023 0.056 0.053 0.034 0.021 0.075 0.088]; result = sum(a(a>0.05))

Sum of elements in an array over x

a = [0.023 0.056 0.053 0.034 0.021 0.075 0.088]; result = sum(a(a>0.05))

4 years ago | 1

| accepted

Answered

Building a matrix inside a for loop

You could do it as follows: xlsData = xlsread('PartS_all.xlsx'); partID = xlsData(:,4); uPartID = unique(partID).'; % Unique ...

Building a matrix inside a for loop

You could do it as follows: xlsData = xlsread('PartS_all.xlsx'); partID = xlsData(:,4); uPartID = unique(partID).'; % Unique ...

4 years ago | 0

| accepted

Answered

how to store coordinate values xy[] for randomly generate point

The format you used (based on the code you provided) is a structure and the format you are looking for is an array. To generate ...

how to store coordinate values xy[] for randomly generate point

The format you used (based on the code you provided) is a structure and the format you are looking for is an array. To generate ...

4 years ago | 0

Answered

Multiple combinations of a matrix

Try the following, it should work for any size of M. function x = pairCombos(M) numRows = size(M,1); C = combnk(1:numRows,2...

Multiple combinations of a matrix

Try the following, it should work for any size of M. function x = pairCombos(M) numRows = size(M,1); C = combnk(1:numRows,2...

4 years ago | 0

| accepted

Answered

How to reshape in 3D a downsampled matrix

Easiest thing to do would be just this: newData = data(1:factor:end,1:factor:end,1:factor:end);

How to reshape in 3D a downsampled matrix

Easiest thing to do would be just this: newData = data(1:factor:end,1:factor:end,1:factor:end);

4 years ago | 0

| accepted