Community Profile

# Benjamin Kraus

### Boston University

57 total contributions since 2010

Contributions in
View by

Submitted

A MEX function to read a PLX data file (Plexon, Inc.).

Submitted

matwho
Quickly list the variables in the specified .MAT file.

Submitted

nanconv
Convolution in 1D or 2D ignoring NaNs and (optionally) correcting for edge effects.

Submitted

nantowhite
Convert a 2D matrix into an image with NaNs replaced by white

Submitted

nanconvn
Convolution in ND ignoring NaNs and (optionally) correcting for edge effects.

Solved

Find state names that end with the letter A
Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

3 years ago

Solved

Kaprekar Steps
6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

3 years ago

Solved

Find relatively common elements in matrix rows
You want to find all elements that exist in greater than 50% of the rows in the matrix. For example, given A = 1 2 3 5 ...

3 years ago

Solved

Alphabetize by last name
Given a list of names in a cell array, sort the list by the last name. So if list = {'Barney Google','Snuffy Smith','Dagwood ...

3 years ago

Solved

Interpolator
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

3 years ago

Solved

Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

3 years ago

Solved

Create times-tables
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...

4 years ago

Posted

I'm trying to speed up two pure m-file functions that I wrote for reading pieces of data from a binary data file. The data files...

4 years ago | 1232 views

Posted

Fit a linear function of two angles
I've got two lists of angles (in radians, ranging from -pi to pi), that have a fixed offset from each other (plus a fair bit of ...

4 years ago | 3404 views

Solved

Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

4 years ago

Solved

The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

4 years ago

Solved

Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

4 years ago

Solved

Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

4 years ago

Solved

Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

4 years ago

Solved

Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

4 years ago

Solved

Sort numbers by outside digits
Sort the array so that they are sorted as if their value was a 5 digit number made from the first three and last two digits of t...

4 years ago

Solved

Poker Series 05: isStraight
The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is t...

4 years ago

Solved

Poker Series 04: isFlush
The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is t...

4 years ago

Solved

Poker Series 03: isFullHouse
The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is t...

5 years ago

Solved

The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to...

5 years ago

Solved

Poker Series 01: isStraightFlush
The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is t...

5 years ago

Solved

Is my wife right?
Regardless of input, output the string 'yes'.

5 years ago

Solved

Eight Queens Solution Checker
Write a function to verify whether an arrangement of queens on a chessboard is a valid solution to the classic <http://en.wikipe...

5 years ago

Responded

Re: Quickly list variables in a MAT-file
James, Thanks for your feedback. I'm not as familiar with MEX programming as I am with MATLAB in general (and my general C know...

5 years ago | 10462 views

Responded

Re: Quickly list variables in a MAT-file
include "string.h" #include "mex.h" #include "mat.h" void mexFunction( { }

5 years ago | 10462 views