Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

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

13 years ago | 2

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

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

13 years ago | 0

| accepted

Solved


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

13 years ago

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

13 years ago | 3

| accepted

Answered
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(:,...

13 years ago | 0

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

13 years ago | 0

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

13 years ago | 0

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

13 years ago | 0

Answered
double to string in a cell
help cellfun

13 years ago | 0

Solved


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

13 years ago

Solved


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

13 years ago

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

13 years ago | 6

| accepted

Load more