A résolu


Maintain shape of logical-index mask
When using logical indexing into an array, MATLAB returns a vector output. For example, if A = magic(3); mask = logi...

presque 13 ans il y a

A résolu


Pi Estimate 1
Estimate Pi as described in the following link: <http://www.people.virginia.edu/~teh1m/cody/Pi_estimation1.pdf>

presque 13 ans il y a

A résolu


Pizza value using expression with parentheses
Pizza prices are typically listed by diameter, rather than the more relevant feature of area. Compute a pizza's value (cost per ...

presque 13 ans il y a

A résolu


Multielement indexing of a row array
The row array birthRateChina stores the China birth rate (per 1000 people) for years 2000 to 2012. Write a statement that create...

presque 13 ans il y a

A résolu


Lightning strike distance: Writing a function
Write a function named LightningDistance that outputs "distance" given input "seconds". Seconds is the time from seeing lightnin...

presque 13 ans il y a

A résolu


Create a row array using double colon operator
Create a row array from 9 to 1, using the double colon operator.

presque 13 ans il y a

A résolu


Circle area using pi
Given a circle's radius, compute the circle's area. Use the built-in mathematical constant pi.

presque 13 ans il y a

A résolu


Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

presque 13 ans il y a

A résolu


Fahrenheit to Celsius using multiple statements
Given a Fahrenheit value F, convert to a Celsius value C. While the equation is C = 5/9 * (F - 32), as an exercise use two state...

presque 13 ans il y a

A résolu


sum of first 'n' terms
Given n=10, find the sum of first 'n' terms Example: If n=10, then x=1,2,3,4,5,6,7,8,9,10. The sum of these n=10 terms is 55...

presque 13 ans il y a

Réponse apportée
Calling variables using variable list in character array
You could create a structure from the string of variable names, like so: varNames = ['var1';'var2';'var3']; %example charac...

presque 13 ans il y a | 2

A résolu


Set some matrix elements to zero
First get the maximum of each *row*, and afterwards set all the other elements to zero. For example, this matrix: 1 2 3 ...

presque 13 ans il y a

A résolu


Find the list of all open files
In the test suite, I use <http://www.mathworks.com/help/matlab/ref/fopen.html fopen> to create new files. The task is to find th...

presque 13 ans il y a

A résolu


Simple date to serial no. conversion
Convert a date string to a serial date number. For example if you take x='19-May-2001' then the result is 730990 x...

presque 13 ans il y a

A résolu


Get the elements of diagonal and antidiagonal for any m-by-n matrix
In the problem <http://www.mathworks.com/matlabcentral/cody/problems/858-permute-diagonal-and-antidiagonal Problem 858. Permute ...

presque 13 ans il y a

A résolu


Create a matrix from a cell
In this problem , you must convert a cell into a matrix and pad each cell with NaN. *Example 1:* If you have the input...

presque 13 ans il y a

A résolu


Parasitic numbers
Test whether the first input x is an n-parasitic number: <http://en.wikipedia.org/wiki/Parasitic_number>. ( _n_ is the second in...

presque 13 ans il y a

A résolu


does it touch ?
given a sentence, tell how much it touches. input : string output : how much it touches touching : a bilabial phoneme d...

presque 13 ans il y a

A résolu


Remove the small words from a list of words.
Your job is to tidy up a list of words that appear in a string. The words are separated by one or more spaces. Remove all words ...

presque 13 ans il y a

Réponse apportée
Automatically update plots in GUI
So you want your axes to update whenever data is typed into your editboxes? If so, wouldn't you just put the relevant code into ...

presque 13 ans il y a | 0

| A accepté

A résolu


Matrix with different incremental runs
Given a vector of positive integers a (>=0); How does one create the matrix where the ith column contains the vector 1:a(i) poss...

presque 13 ans il y a

Réponse apportée
How can I randomly select a row from a matrix?
Try this: ind = ceil(rand * size(m,1)); mrow = m(ind,:);

presque 13 ans il y a | 3

| A accepté

Réponse apportée
How can I fill an array of images from inside a for loop?
It looks like you're trying to assign a [nxm] matrix (the image) to a [1xm] row in AllFaces. Instead, try this: AllFaces(:,...

presque 13 ans il y a | 0

Réponse apportée
fprintf: Function is not defined for 'cell' inputs.
It sounds like "problem_statement" is a cell array, and fprintf cannot accept cells as arguments. What if you change the second ...

presque 13 ans il y a | 0

Réponse apportée
How do you enable a user to maximize an axes on a matlab GUI?
Do you mean you want the user to be able to set the axes to fill the GUI window? To do this, you could change the "Position" pro...

presque 13 ans il y a | 0

Réponse apportée
Replicating a matrix in matlab
Because the amount you're replicating each element of V by varies according to p, the resulting rows in A are not of the same si...

presque 13 ans il y a | 0

Réponse apportée
double to string in a cell
help cellfun

presque 13 ans il y a | 0

A résolu


Sunday bonus
Submit a solution on any Sunday and you will get 10 points. Only for MATLAB fans!

presque 13 ans il y a

A résolu


Spot the outlier
All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

presque 13 ans il y a

Réponse apportée
Plot multiple graphs to a single axis handle
Something like hold(axes_handle,'on') should work. The only thing I can think of without seeing more of your code is th...

presque 13 ans il y a | 6

| A accepté

Charger plus