Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

ongeveer 9 jaar ago

Solved

Make a 1 hot vector

Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

ongeveer 9 jaar ago

Solved

Unique values without using UNIQUE function

You must return unique values in a vector in *stable* mode without using the unique function. About stable order flag: ...

meer dan 9 jaar ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

meer dan 9 jaar ago

Solved

intersection of matrices

Given two matrices filled with ones and zeros, determine if they share a common row, column entry. These matrices are of identi...

meer dan 9 jaar ago

Solved

Number of Horns on a unicorn!

Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

meer dan 9 jaar ago

Solved

Back to basics 26 - Keywords

Covering some basic topics I haven't seen elsewhere on Cody. Return a cell array of strings of all MATLAB keywords.

meer dan 9 jaar ago

Solved

Back to basics 12 - Input Arguments

Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

meer dan 9 jaar ago

Solved

Program an exclusive OR operation with logical operators

Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...

meer dan 9 jaar ago

Solved

Roll the Dice!

*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

meer dan 9 jaar ago

Solved

Weighted average

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

meer dan 9 jaar ago

Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

meer dan 9 jaar 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...

meer dan 9 jaar ago

Solved

Create a vector whose elements depend on the previous element

The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

meer dan 9 jaar ago

Solved

Find the numeric mean of the prime numbers in a matrix.

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

meer dan 9 jaar ago

Solved

Sum the entries of each column of a matrix which satisfy a logical condition.

Given a numeric matrix A and a logical array L of the same size as A, return a row vector S containing the columnwise sums of th...

meer dan 9 jaar ago

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

meer dan 9 jaar ago

Solved

Back to basics 9 - Indexed References

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

meer dan 9 jaar ago

Solved

Sum all integers from 1 to 2^n

Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

meer dan 9 jaar ago

Solved

Replace all zeros and NaNs in a matrix with the string 'error'

Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with ...

meer dan 9 jaar ago

Solved

Replicate elements in vectors

Replicate each element of a row vector (with NaN) a constant number of times. Examples : n=2, A=[1 2 3] -> [1 1 2 2 3 3] n=0...

meer dan 9 jaar ago

Solved

Right and wrong

Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

meer dan 9 jaar 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...

meer dan 9 jaar ago

Solved

Check if sorted

Check if sorted. Example: Input x = [1 2 0] Output y is 0

meer dan 9 jaar ago

Solved

Reverse the vector

Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

meer dan 9 jaar ago

Solved

Remove the air bubbles

Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

meer dan 9 jaar 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...

meer dan 9 jaar ago

Solved

Are all the three given point in the same line?

In this problem the input is the coordinate of the three points in a XY plane? P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) how can...

meer dan 9 jaar ago

Solved

Return the 3n+1 sequence for n

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

meer dan 9 jaar ago