Community Profile

Contact

Top 1% contributor

If you know the fields in advance, you can create a 0x0 struct array WITH fields using the syntax s = struct('a',{},'b',{})...

2

Answered 1 year ago

What you could do is take a sum across the row, e.g. x = [NaN 1; 1 1; 1 NaN]; y = sum(x,2); Then the result is y = [NaN 2 NaN]...

90725 views

Responded 3 years ago

In case anyone else stumbles upon here looking for a solution instead of uncharacteristic vitriol... The answer was that when y...

10196 views

Responded 1 year ago

you just measured its surface area, that is the input.

Solve this!

2 years ago

Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

Write code which replaces the number 1 with two NaNs. Example X = [ 1 2 NaN 4 1 3 7 NaN 1 4 NaN 2] ...

Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

3 years ago

Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...

Given a vector of lengths [a b c], determines whether a triangle with non-zero area (in two-dimensional Euclidean space, smarty!...

Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

you just discovered its circumference, that is the input.

*Description* A simple yet tedious task occurs near the end of most Sudoku-solving algorithms, computerized or manual. The ta...

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

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

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

Covering some basic topics I haven't seen elsewhere on Cody. Given an input variable 'x', save it to disk in a file named 'co...

Load more