Top 5% contributor
Thinking again, I realize that ismember is all I need
will do it.
Answered 3 years ago
Thanks for the three solutions. Here is a function to test all three. "method_1" wins as the most elegant and fastest, but the o...
Given two vectors A and B, find the index, idx into A of the element of B so that
Now I know there must be many ways...
Asked 4 years ago
So the follow-up question would be why are trailing singleton dimensions ignored? I have a test case where I supply a 3D matrix ...
4 years ago
Why does ndims(zeros(1,1,1)) equal 2 and not 3?
4 years ago
Say I have an image which I plot in a figure and print that figure to a .tiff file. The original image has size [257,250] T...
5 years ago
For the following code
the MATLAB Editor Code Analyzer warns
"The value assigned to var...
Asked 3 years ago
5 years ago
Un undocked editor window has the full path long filename to the file being edited in the title of the window. For long paths, t...
Given vectors x and y each with N elements, I want to create an N element structure s with fields s.x and s.y. I can do this by ...
When compiling some C-code using mex I get this error. error: expected expression before ‘/’ token Any suggestions...
7 years ago
I am plotting multiple sets of data on the same axes with set 1 in blue and set 2 in green and would like to make a legend with ...
9 years ago
I am looking for a way to start MATLAB from the command line, with all the gui stuff, so that MATLAB's current working directory...
I have a power signal that is strictly positive. I'd like to low-pass filter it, retaining the positive property. I know I can u...
How could I find the most efficient FFT size greater than N? I know that with fftw "sizes that are products of small factors are...
I have been playing around, in MATLAB 2012b, with setting the fonts in a Figure. I have done this both under OS X and Windows 7,...
Does anyone know how to scale the output of PMUSIC to give power spectral density? Running a modified version of the example in...
10 years ago
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...
3 years ago
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...
Remove all the vowels in the given phrase.
Input s1 = 'Jack and Jill went up the hill'
Output s2 is 'Jck nd Jll wn...
Given n, find the sum of the digits that make up 2^n.
Input n = 7
Output b = 11
since 2^7 = 128, and 1 + ...
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...
There will always be at least one prime in the matrix.
Input in = [ 8 3
5 9 ]
Output out is 4...
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...
Join the conversation