Answered

circshift columns of array by different shift size

I think this does what you want. HH=cell2mat(arrayfun(@(k) circshift(d(:,k),k),1:size(d,2),'uni',0)) HH = ...

circshift columns of array by different shift size

I think this does what you want. HH=cell2mat(arrayfun(@(k) circshift(d(:,k),k),1:size(d,2),'uni',0)) HH = ...

5 years ago | 1

| accepted

Answered

How to find all unique Names in a Matrix

I think the problem is the NaNs. If you don't remove them, as Image Analyst does when defining ca2, the unique function seems t...

How to find all unique Names in a Matrix

I think the problem is the NaNs. If you don't remove them, as Image Analyst does when defining ca2, the unique function seems t...

5 years ago | 0

Solved

Solve the Sudoku Row

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

5 years ago

Solved

Number of 1s in the Binary Representation of a Number

*Description* Return the number of 1s in the (unsigned integer) binary representation of a number. This function should be ab...

5 years ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

5 years ago

Answered

how i will choose a random element of a matrix and then find in which row,column it is

I think something like this would work. is01 = true; initialize flag for while loop while is01 ind=randi(num...

how i will choose a random element of a matrix and then find in which row,column it is

I think something like this would work. is01 = true; initialize flag for while loop while is01 ind=randi(num...

5 years ago | 0

Answered

Accessing multidimensional array with pairwise indices

I think your for loop is only getting data off the top page of the array. When I run your code, B is [ni 1], but all the others...

Accessing multidimensional array with pairwise indices

I think your for loop is only getting data off the top page of the array. When I run your code, B is [ni 1], but all the others...

5 years ago | 1

Answered

Accessing multidimensional array with pairwise indices

I think sub2ind is the recommended approach in most cases. If you want to avoid repmat, you can do something like this. >> ...

Accessing multidimensional array with pairwise indices

I think sub2ind is the recommended approach in most cases. If you want to avoid repmat, you can do something like this. >> ...

5 years ago | 0

Answered

Assigning values to vectors of different lenghts

It's not clear what you need *a* for. You can make *d* directly from *c* and *b* as follows: >> d=b(c) d = ...

Assigning values to vectors of different lenghts

It's not clear what you need *a* for. You can make *d* directly from *c* and *b* as follows: >> d=b(c) d = ...

5 years ago | 2

Solved

Rumis Scorer 4

This problem is very similar to <https://www.mathworks.com/matlabcentral/cody/problems/3101-rumis-scorer-3 Rumis Scorer 3>. The ...

5 years ago

Solved

Rumis Scorer 3

<http://en.wikipedia.org/wiki/Rumis Rumis> is a multiplayer 3D block board game where the goal is to have the most squares visib...

5 years ago

Solved

Rumis Scorer 2

<http://en.wikipedia.org/wiki/Rumis Rumis> is a multiplayer 3D block board game where the goal is to have the most squares visib...

5 years ago

Solved

Rumis Scorer 1

<http://en.wikipedia.org/wiki/Rumis Rumis> is a multiplayer 3D block board game where the goal is to have the most squares visib...

5 years ago

Solved

Magic!

Check whether the input matrix is a normal magic square: <http://en.wikipedia.org/wiki/Magic_square> Output the logical va...

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

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

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

5 years ago

Solved

Find the palindrome

Given the string a, find the longest palindromic sub-string b. So when a = 'xkayakyy'; you should return b = 'kayak';

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

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

5 years ago

Solved

Given an unsigned integer x, find the largest y by rearranging the bits in x

Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

5 years ago

Solved

Omit columns averages from a matrix

Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

5 years ago

Solved

Increment a number, given its digits

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

5 years ago

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

5 years ago

Solved

All your base are belong to us

Find the base _b_ logarithm of the input decimal number _x_. Express the output as a decimal number. The first argument is the n...

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

5 years ago

Solved

Remove DC

Input x is the sampled signal vector, may have both AC and DC components. Output y should not contain any DC component. Examp...

5 years ago

Solved

Duplicate each element of a vector.

for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Ex...

5 years ago

Solved

Convert a vector into a number

This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

5 years ago

Solved

feeling VERY lucky?

Just like Matthew's problem <http://www.mathworks.com/matlabcentral/cody/problems/2793 2793> and Edward's problem <http://www.ma...

5 years ago