Top 5% contributor
I started using the Matlab debugger heavily recently, and I noticed the following odd naming. You can print the call trace with ...
4 years ago
Given a matrix M, return a vector y such that for each k
(y(k) is the Euclidean norm of the k-th col...
4 years ago
It seems that you can indeed, see http://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/?
I cannot understa...
Answered 4 years ago
I know Matlab uses copy-on-write; that is, if I assign |a=b| and then never modify |a| and |b|, they point to the same chunk of ...
Asked 4 years ago
Suppose a,b,c,d are instances of a custom Matlab class. I can redefine [a b] and [a;b] by overloading horzcat() and vertcat(); h...
I am using a GLOBAL statement inside an if command, so that I import the global variable into the local namespace only if it is ...
Asked 5 years ago
Consider the following scenario.
I have a function that accepts paired name/value arguments, e.g.
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...
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".
Given a and b, return the sum a+b in c.
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...
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.]
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...
Calculate the nth Fibonacci number.
Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ...
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN.
Given the number x, y must be the summation of all integers from 1 to 2^x.
For instance if x=2 then y must be 1+2+3+4=10.
Return 1 if the input is sorted from highest to lowest, 0 if not.
1:7 -> 0
[7 5 2] -> 1
Given the input n, return true if n is odd or false if n is even.
Try out this test problem first.
Given the variable x as your input, multiply it by two and put the result in y.
I am using the GLOBAL instruction inside an if statement, to create a global variable only if it is needed. However, the code an...
Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a location from the following list:
See all countries