# Matt J

Professional Interests: medical image processing, optimization algorithms

PLEASE NOTE: I do not read email sent through my author page. Please post questions about FEX submissions in their respective Comments section.

**Statistics**

RANK**7**

of 239 339

REPUTATION**20 176**

CONTRIBUTIONS

**192** Questions

**7 973** Answers

ANSWER ACCEPTANCE **
75.52%
**

VOTES RECEIVED**2 710**

RANK**265** of 16 805

REPUTATION**5 116**

AVERAGE RATING**4.90**

CONTRIBUTIONS**33** Files

DOWNLOADS **290**

ALL TIME DOWNLOADS**43157**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

How to set a custom equation to fit 5 points in space by fitsurface?

I can't find "fitsurface" in the Mathworks documentation, but the fit is easy enough to do algebraically. x=x(:); y=y(:); z=z(:...

ungefär 2 timmar ago | 0

Why is x(:) so much slower than reshape(x,N,1) with complex arrays?

The following simple test seems to support @Bruno Luong's conjecture that (:) results in data copying. The data of B1 resulting ...

ungefär 6 timmar ago | 0

Is it possible to correctly perform a multi-dimensional FFT on a 1D linearised version of a 3D array?

Reshaping to and from 3D format should not add significant cost: Nx = 256; Ny = 256; Nz = 128; N = Nx*Ny*Nz; A0 = rand(N,1)...

ungefär 19 timmar ago | 0

| accepted

Question

Why is x(:) so much slower than reshape(x,N,1) with complex arrays?

The two for loops below differ only in the flattening operation used to obtain A_1D . Why is the run time so much worse with A_3...

ungefär 20 timmar ago | 3 answers | 0

### 3

answerssee the 3d image and see the coordinates while moving the mouse over the image

You can use imshow() to display any particular slice of the image and then use the axis datatip button to get the in-slice 2D co...

2 dagar ago | 0

How do i find the coordinates of a boundary

How about simply, [m,n]=size(Image); I=boundary(:,1); J=boundary(:,2); corner1 = [1, max(J(I==1))]; %row/column coordinat...

2 dagar ago | 0

How to Draw an ellipsoid between two 3d coordinates

Another way would be to use the ellipsoidalFit.groundTruth method in this File Exchange submission. https://www.mathworks.com/m...

2 dagar ago | 0

Trying to count the number of pixels in an image over a specific RBG value

results.area=nnz(imstd>90);

2 dagar ago | 0

| accepted

Normally distributed random numbers with fixed sum

Why not simply, x(1:N-1)=randn(1,N-1); x(N)=fixedValue-sum(x(1:N-1))

2 dagar ago | 0

Only analyze what is outlined in black in an image

If you have a binary mask of the circles, you can just do numBlack = nnz( circles & ~BW ); numWhite = nnz( circles & BW);

2 dagar ago | 0

If the quadprog problem is infeasible, how i can solve it with a certain tolerance?

It never really makes sense to have more equality constraints (here 36) than you do unknowns ( here 6). In order for the problem...

4 dagar ago | 0

| accepted

How to construct a "ones" matrix with zero blocks in the diagonal

repelem(1-eye(4),4,4)

5 dagar ago | 1

Iterative solution of non-linear equation with a provided guess value?

You could use fzero's OutputFcn option https://www.mathworks.com/help/optim/ug/fzero.html#btn3z5s-options to access the sequen...

5 dagar ago | 0

Iterative solution of non-linear equation with a provided guess value?

Using fsolve() instead of fzero(), you could solve the problem as a system of two equations in two unknowns. The two unknowns ar...

5 dagar ago | 0

Failure in initial user-supplied nonlinear constraint function evaluation

One problem: nonlcon = @simple_constraint; There is no function called 'simple_constraint' in your attached script. There is a...

5 dagar ago | 1

| accepted

for loop for permutations of for length of array

List=nchoosek([a,b,c],2); for i=1:size(List,1) p1=List(i,1); p2=List(i,2); ... end

6 dagar ago | 1

| accepted

How do I use an if-else structure inside a for loop to investigate if each component of a row vector is inside or outside the boundaries?

Hint: for i=1:numel(vec) v=vec(i); end

6 dagar ago | 0

2*2 Matrix factorization/decomposition

I also found out what I wanted may have something to do with PLU(permuted lower upper decomposition), but am clueless to how to ...

6 dagar ago | 0

How can I call a script within a for loop, looping over multiple files?

result = scriptname(ID{nSubject},Visit{nVisit});

7 dagar ago | 0

| accepted

I am trying to find the exact distance of a curvy line.

Why not as follows? I2 = imread('image.jpeg'); blue=bwareafilt( I2(:,:,1)<=50 & I2(:,:,2)<=50 & I2(:,:,3)>=200, 1); Len...

7 dagar ago | 0

| accepted

Number of branches per branch point

Perhaps as follows: k=ones(3); k(5)=0; neighborCount=conv2(double(BW),k,'same'); neighborCount=neighborCount.*(neighborCo...

7 dagar ago | 0

| accepted

Rank deficient error.

Are you attempting to do matrix division? if not use ./ instead.

7 dagar ago | 1

| accepted

Merge struct with matrix

You cannot avoid a for-loop altogether, but you can avoid writing your own for-loop as follows: tmp=num2cell(modelOutputSignal,...

7 dagar ago | 0

| accepted

Unable to detect Iris boundary using imfind circles

Increasing the lower radius bound as suggested by @Jonas as well as increasing the sensitivity setting seems to help: A=any( im...

7 dagar ago | 0

| accepted

adjusting the code from optimization output from minimum to maximum

fun=str2func(FUNCTION_NAME); fun=@(x) -fun(x); [Scaled_x_Single,fval,exitflag,output,population,scores] = ga(,3,[],[],[],[],...

8 dagar ago | 0

Question

Re-import a binary map into Image Segmenter or Color Thresholder

I have generated a binary mask of an image using the Image Segmenter app. I am wondering if it is possible to re-import that mas...

8 dagar ago | 1 answer | 0

### 1

answerFind elements from a submatrix in the main 3D matrix

[row,col]=find( reshape( ismember(M(:),A(:)) , size(M) ) );

8 dagar ago | 1

| accepted

How to smooth data to a negative curve

Thie File Exchange submission allows you to do spline smoothing with monotonicity constraints: https://www.mathworks.com/matlab...

8 dagar ago | 0

| accepted

Create new field on struct from names on existing field

names={Stimuli.names}; idxBlue=contains(names,["H1" "H2" "H3"]); idxRed =contains(names,["H4" "H5" "H6"]); [Stimuli(idxBlue...

8 dagar ago | 0

| accepted

How to guide bwconncomp to specific region of image?

If you have a binary circleMask of the circular region, you can use bwlmaskpropfiltn (Download) to eliminate all objects in a la...

9 dagar ago | 0