Community Profile

# Marta

### TechSource Systems Pte Ltd

58 total contributions since 2017

View details...

Contributions in
View by

Solved

Reverse the elements of an array
Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

presque 4 ans ago

Solved

Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

presque 4 ans ago

Solved

Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

presque 4 ans ago

Solved

Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

presque 4 ans ago

Solved

Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

presque 4 ans ago

Solved

Balanced number
Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

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

presque 4 ans ago

Solved

Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

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

presque 4 ans ago

Solved

Reindex a vector
You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

presque 4 ans ago

Solved

middleAsColumn: Return all but first and last element as a column vector
Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

presque 4 ans ago

Solved

First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

presque 4 ans ago

Solved

Generate N equally spaced intervals between -L and L
Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

presque 4 ans ago

Solved

Specific Element Count
Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

presque 4 ans ago

Solved

Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

presque 4 ans ago

Solved

Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

presque 4 ans ago

Solved

Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

presque 4 ans ago

Solved

Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

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

presque 4 ans ago

Solved

Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

presque 4 ans ago

Solved

Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

presque 4 ans 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,...

presque 4 ans ago

Solved

Which doors are open?
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...

presque 4 ans ago

Solved

Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

presque 4 ans ago

Solved

Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

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

presque 4 ans ago

Solved

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

presque 4 ans ago

Solved

Sort a list of complex numbers based on far they are from the origin.
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...

presque 4 ans ago

Solved

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

presque 4 ans ago

Solved

Which values occur exactly three times?
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...

presque 4 ans ago