A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


"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) ...]...

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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 same order a...

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ un mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


Duplicates
Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


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

environ 2 mois il y a

A résolu


Dog Statistics
The vectors ht and wt contains the heights and weights of 20 golden retrievers. In some cases, it was not possible to make both ...

3 mois il y a

A résolu


Simpson's Paradox - Calculate correlation coefficients for groups of data
Simpson's Paradox is a statistical phenomenon where groups of data can have a characteristic while the whole data set together h...

3 mois il y a

A résolu


Where the Four Corners Am I? (Vectorized)
NOTE: this problem is intended to build on problem #55960 ("Where the Four Corners Am I?"). You may wish to solve that problem f...

3 mois il y a

A résolu


Where the Four Corners Am I?
The "Four Corners" region of the US is where Colorado, Utah, Arizona, and New Mexico all meet - the only place where four states...

3 mois il y a

A résolu


Interpolated Value Between Two Points
Given two points, and , a new location x, and a method "linear" or "cubic", return the value of a linear or cubic interpolant t...

3 mois il y a

A résolu


Generate Tribonacci Sequence
The "Tribonacci" sequence is an extension of the idea of the Fibonacci sequence: That is, each new term is the sum of the thr...

3 mois il y a

Charger plus