Community Profile

# Ken Atwell

### MathWorks

356 total contributions since 2011

Former product manager for MATLAB, but the company decided to trust me with the source code, so now I'm a developer.

View details...

Contributions in
View by

Solved

Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

1 year ago

Solved

Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

1 year ago

Solved

Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

1 year ago

Solved

Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

1 year ago

Solved

Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples : n=2, A=[1 2 3] -> [1 1 2 2 3 3] n=0...

1 year ago

Solved

Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

1 year ago

Solved

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

1 year ago

Why can't I mex cpp with matlab?
MEX is working as expected. How old is this code? Xcode's compiler is alerting you to several risky programming patterns bei...

1 year ago | 1

Does anyone know how to run selection on mac?
Shift+F7. If you are on a lap, depending on your system preferences, you might need to add Fn to that chord (I do). As Jan sug...

2 years ago | 1

Why did I get this error?
The function |deg2rag| was introduced in R2015b, according to the <http://www.mathworks.com/help/matlab/ref/deg2rad.html documen...

2 years ago | 0

OS X 10.5.8 install
R2010b was the last release to support OS X 10.8: <http://www.mathworks.com/support/sysreq/release2010b/macintosh.html>

2 years ago | 0

multiple line edit is not allowed on MATLAB file editor window?
The MATLAB Editor does not have this, I think. Do you have an example MATLAB source file you can share with us where this kind ...

2 years ago | 0

Question on using a while loop?
To add the bet from the total, use: Bank = Bank + Bet; Subtraction will be similar, using "-" of course. To get your p...

2 years ago | 0

Does matlab become slow and unusable when working in a folder with many files?
When you cd into a folder with 50,000 file, bear in mind that *all of these files are visible from MATLAB path*, and therefore m...

2 years ago | 1

Can anyone help me with telling me how my variable is undefined?
You are writing a function that accepts 'temperature' as an input parameter. So, 'temperature' will exist inside your functions...

2 years ago | 0

Applying multiple conditions to an 'if' statement
You might be looking for <http://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html logical operators>.

2 years ago | 0

Mex can't find compiler after Xcode 7 update (R2015b)
*EDIT* MathWorks has produced a patch for this issue. If at all possible, use the procedure outlined at http://www.mathworks.co...

2 years ago | 16

| accepted

Print out values in a while loop each time into an array.
A semicolon at the end of the line suppresses output [ <http://www.mathworks.com/help/matlab/matlab_prog/symbol-reference.html#b...

2 years ago | 0

32 bit mex file not working in a 64 bit version of matlab
This is a stab in the dark, but a Google search found <https://github.com/filipjares/tdv/tree/master/src/gcs/private this on Git...

2 years ago | 2

Tranform Python code in Matlab
MATLAB is 1-indexed, so I think you're looking for something like: diff = X(pairs(:,1),:) - X(pairs(:,2),:);

2 years ago | 0

Read in file that has raw binary image data and an XML footer
You've got the right idea. Since you know the size of the image, open the mixed image/XML file with <http://www.mathworks.com...

2 years ago | 0

| accepted

how to select a number randomly from a series of fixed number
>> a(randi(numel(a))) In other words, pick a random (integer) number _N_ between 1 and the number of elements in "a", then r...

2 years ago | 0

| accepted

Why can parfor only write to one dimension?
From parfor's perspective, "result" is being accessed randomly. Try this instead: parfor i=index results1{i} = an...

2 years ago | 0

How to do better commenting in Matlab script?
You'll get to the settings you need under "Home -> Preferences -> Editor/Debugger -> Display" and "Home -> Preferences -> Editor...

2 years ago | 0

Generating a mex file from .m file
It looks like your system does not have the GNU C++ standard library installed. I believe this can be the case in some down dis...

2 years ago | 0

How can I setup MATLAB to differentiate things like recent directories and command histories for two unrelated projects?
I don't think there is direct support for like this you describe. Path management can be semi-automated with scripts, but comma...

2 years ago | 0

| accepted

Bug in matlab 2013b: all windows resize (get very small) when I right click in the Editor. It returns to normal only when program is restarted.

3 years ago | 0

Why Matlab window gets smaller pressing right mouse button?

3 years ago | 0

parallel computing speed question when the body of the parfor loop takes about 2 seconds
It really depends on what "dosomething" is doing. If it is pure computation, it should be a big win. If there is file or netwo...

3 years ago | 0

| accepted