Solved

Split a string into chunks of specified length

Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

bijna 3 jaar ago

Solved

Calculate the Hamming distance between two strings

Inspired by a similar Cody problem found <http://www.mathworks.com/matlabcentral/cody/problems/93-calculate-the-levenshtein-dist...

bijna 3 jaar ago

Solved

Create a matrix X, where each column is a shifted copy of the vector v

Example : in->v = (1:5)'; 1 2 3 4 5 out-> [1 5 4 3 2;2 1 5 4 3;3 2 1 5 4;4 3 2 1 5;5 4 3 ...

bijna 3 jaar ago

Solved

Symmetric matrix

You must create a n-by-n *symmetric* matrix such that A(row,col) = row/col for col >= row. Example if n =3 : output is : ...

bijna 3 jaar ago

Solved

7 segment LED display

Given a whole number, output how many segments would be lit up to display it on a 7 segment LED display (see Wikipedia: <http://...

bijna 3 jaar ago

Solved

Additive persistence

Inspired by Problem 2008 created by Ziko. In mathematics, the persistence of a number is the *number of times* one must apply...

bijna 3 jaar ago

Solved

Reverse Calculator

Use this reverse calculator and give correct output Its simple, In my Reverse calculator if you press 0 it will be considered...

bijna 3 jaar ago

Solved

Horizontal matrix sort

Given a matrix x with n rows and m columns, return a matrix y with n rows and 2m columns, such that every row in x is sorted fro...

bijna 3 jaar ago

Solved

Solitaire Cipher

Implement the <http://en.wikipedia.org/wiki/Solitaire_(cipher) solitaire cipher>. Since this is from Wikipedia, I am capturin...

bijna 3 jaar ago

Solved

Speed of car

Calculate the Speed of car given its Distance travelled and time taken in x and y respectively

bijna 3 jaar ago

Solved

Convert yards to feet

The goal of this script is to convert a value given in yards to feet.

bijna 3 jaar 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...

bijna 3 jaar ago

Solved

Matlab Basics II - Create a vector with a repeated entry

Create a row vector of length n, filled with 4's, for example, if n = 3 output = [4 4 4] make sure to round UP when n is a...

bijna 3 jaar ago

Solved

Square a Number

Given an input x, return y, which is equal to the square of x.

bijna 3 jaar ago

Solved

Rotate matrix by -90 degrees

Rotate a Matrix by -90 degrees Example: X = 1 2 3 4 5 6 7 8 9 output = 7 4 ...

bijna 3 jaar ago

Solved

Rotate array 90 degrees

Rotate the given matrix by 90 degrees. Example, A = [1 2 3 ; 4 5 6 ] B = rotated(A) = [ 3 6; 2 5; 1 4 ]

bijna 3 jaar ago

Solved

Change matrix to vector

Vector is a matrix whose size is 1 x n or n x 1. Change matrix to vector. x = 4 3 5 1 ...

bijna 3 jaar ago

Solved

Basic commands - Greatest common divisor

Please write a function, which, will put as output greatest common divisor. Example: A = [-5 17; 10 0];...

bijna 3 jaar ago

Solved

MATCH THE STRINGS (2 CHAR) very easy

Match the given string based on first two characters on each string. For example A='harsa'; b='harish'; result '1' ...

bijna 3 jaar ago

Solved

Change the sign of even index entries of the reversed vector

change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

bijna 3 jaar ago

Solved

Geometric series

Find the sum, given the first term t1, the common ratio r, and number of terms n. Examples If input t1=1, r=1, n=7 the...

bijna 3 jaar ago

Solved

Which quadrant?

Given a complex number, output quadrant 'I' 'II' 'III' or 'IV' | II | I | ...

bijna 3 jaar ago

Solved

Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]

The given function returns the index of the maximum value in a given matrix. such as X=[4,3,4,5,9,12,0,5] Ans= 6 if maxim...

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

bijna 3 jaar 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 ...

bijna 3 jaar ago

Solved

"Low : High - Low : High - Turn around " -- Create a subindices vector

Let two vectors *lo* and *hi* be given. The job is to create a index vector like so idx = [lo(1):hi(1) lo(2):hi(2) ...]...

bijna 3 jaar ago

Solved

Is my wife right? Now with even more wrong husband

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

bijna 3 jaar ago