Community Profile

# hao

73 total contributions since 2019

View details...

Contributions in
View by

Solved

Converting numbers back from extended form
Thanks for all the help you guys gave me on writing out the numbers in extended form in <http://www.mathworks.com/matlabcentral/...

2 days ago

Solved

Numbers in extended form
Shhhhhhh. Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out. I just star...

4 days ago

Solved

Ripping numbers apart!
So you have to "rip" a number apart into individual digits... The end output is a cell. That is if: x = 12345678 o...

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

8 days ago

Solved

Natural numbers in string form
Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be. Ex...

10 days ago

Solved

Fix the last element of a cell array
Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

10 days ago

Solved

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

10 days ago

Solved

Remove element(s) from cell array
You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

10 days ago

Solved

Convert a Cell Array into an Array
Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

10 days ago

Solved

Convert a numerical matrix into a cell array of strings
Given a numerical matrix, output a *cell array of string*. For example: if input = 1:3 output is {'1','2','3'} whic...

10 days ago

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

12 days ago

Solved

Create a cell array out of a struct
Create a cell array out of a (single) struct with the fieldname in the first column and the value in the second column: in: ...

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

12 days ago

Solved

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

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

13 days ago

Solved

Cell Counting: How Many Draws?
You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

14 days ago

Solved

Guess Cipher
Guess the formula to transform strings as follows: 'Hello World!' --> 'Ifmmp Xpsme!' 'Can I help you?' --> 'Dbo J ifmq zpv...

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

17 days ago

Solved

Hankelize a matrix
Similar to <http://www.mathworks.com/matlabcentral/cody/problems/42501-toeplitize-a-matrix Problem 42501. Toeplitize a matrix>, ...

17 days ago

Solved

Toeplitize a matrix
Similar to <http://www.mathworks.com/matlabcentral/cody/problems/3094-hankelize-a-matrix Problem 3094. Hankelize a matrix>, now ...

17 days ago

Solved

Go to the head of the class!
You're given a matrix and a single number. If that number is in the matrix, reorder the matrix so that number is in the first r...

20 days ago

Solved

Must be in the front row...
You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

21 days ago

Solved

Replace Nonzero Numbers with 1
Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

21 days ago

Solved

Matrix multiplication across rows
Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix Example ...

21 days ago

Solved

A matrix of extroverts
Now that the introverts have had their script, the extroverts spoke up (naturally!) and demanded one as well. You will be given...

21 days ago

Solved

Enlarge array
Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m...

23 days ago

Solved

frame of the matrix
Given the matrix M, return M without the external frame.

23 days ago

Solved

subtract central cross
Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.

23 days ago

Solved

Given a 4x4 matrix, swap the two middle columns
If a = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; then the result is ans = 1 3 2 4 1 3 2...

23 days ago

Solved

matrix zigzag
Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

24 days ago