Community Profile

photo

Matt J


Last seen: Today
6,462 total contributions since 2009

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.

Contact

Matt J's Badges

  • Personal Best Downloads Level 4
  • First Review
  • 5-Star Galaxy Level 5
  • First Submission
  • Master
  • Revival Level 4
  • 36 Month Streak
  • Thankful Level 4
  • Knowledgeable Level 4
  • First Answer

View details...

Contributions in
View by

Answered
Element wise conditional evaluation of a function over a meshgrid
f = (A==B) .* (A.*(B+2)+lam);

10 hours ago | 2

Answered
How can I get all entries of the lower triangular (simplex) of a tensor with arbitrary dimension?
M=size(A,1); N=ndims(A); C(1:N)={0:M-1}; C{1}=M-(1:M); [C{1:N}]=ndgrid(C{:}); lowerSimplex=sum(cat(N+1,C{:}),N+1)<=(M-1); ...

1 day ago | 0

| accepted

Answered
How to correctly specify fmincon nonlinear constraints
The lengths of the vectors cin and ceq tell fmincon how many inequality and equality constraints you have. So, if they are scala...

1 day ago | 0

| accepted

Answered
why the plotted function implicit doesn't have continuous surface?
Try increasing the mesh density, fimplicit3(f,[0,1500],'MeshDensity',55);

2 days ago | 0

| accepted

Answered
Sort every sixth column
matrix(:,1:6:end)=sort(matrix(:,1:6:end))

3 days ago | 0

Answered
Faster alternative to mode?
Yes, actually there are no zeros in this matrix. -1s could be changed to zeros as they represent void space that I am uninsteres...

3 days ago | 1

Answered
I want to rotate a point using Quaternion function
You could also try this FEX submission instead of the Quaternion class https://www.mathworks.com/matlabcentral/fileexchange/308...

4 days ago | 0

Answered
Faster alternative to mode?
It would be better not to implement the mode calculation repeatedly in a loop over the voxels. If you have enough RAM to hold 27...

4 days ago | 0

Answered
I want to rotate a point using Quaternion function
q1*[1;2;3]

4 days ago | 0

Answered
Extracting indices from 3D matrix for another 3D matrix
[m,n,p]=size(A); [~,J,K]=ndgrid(1:m,1:n,1:p); idx=sub2ind([m,n,p],I,J,K); A(idx)./B(idx)

4 days ago | 0

Answered
Number of sequences with 3 or more ascending numbers
all( diff(v(k:k+2)) >= 0 )

4 days ago | 0

Answered
how to find the angle between 2 points ?
atan2d(y2-y1,x2-x1);

4 days ago | 0

| accepted

Answered
Solving nonlinear equation using newton-raphson method
i=0; del = Inf; while del > tol && i<N i=i+1; f(i) = 3*P*V(i).^3 - P*V(i).^2 + 9*V(i) - 8*...

6 days ago | 1

| accepted

Answered
Creating a multi-dimensional array out of many lower-dimensional arrays
If your "datasets" really are in the form of the Matlab dataset type described here, then I think you could probably just do som...

6 days ago | 0

| accepted

Answered
Cells and Cell vectors help?
So, as a smaller example, if n=4 and the input is this C={ [1 2] , [], [2 3 4], [] }, the output should be this, A = 1...

7 days ago | 0

| accepted

Answered
How to calculate from three points the "normal" at the second point
Once you have answered David's question, the attached function should be useful. It will find the normals to all the facets of a...

8 days ago | 1

Answered
Using Groups of Rows in a Parfor Loop
As mentioned in my comment, your example does not make it clear why a loop is necessary at all. However, the reason for your dif...

9 days ago | 0

| accepted

Answered
Help with non working for loop for generating a matrix
One approach is to write x,y, and A as matrix-valued anonymous functions of c, e.g., x=@(c)(4-c)./(6+c); y=@(c)10./(6+c); ...

11 days ago | 0

| accepted

Answered
Quadratically constrained linear maximisation problem: issues with fmincon
Well, it would be interesting to know what algorithm Gurobi uses, but the issue of the objective function difference appears to ...

11 days ago | 0

Answered
How can I create random Co-ordinate shifts (x,y,z) that add to a displacement of 1?
[a,b,c]=sph2cart(2*pi*rand,pi*rand,1);

11 days ago | 0

| accepted

Answered
How to constrain distance between points in optimization?
It can be set up this way, but keep in mind that this is a highly non-convex feasible set. It may be challenging to find a glob...

12 days ago | 1

| accepted

Answered
Multidimensional operations without for loop
Q=nan(8,n); [J,K]=ndgrid(1:8,1:n); I=maxloc(K); thetaIndices=sub2ind(size(theta), I,J,K); QIndices=sub2ind(...

14 days ago | 0

| accepted

Answered
fzero with function in matrix
syms x a=[sin(x),1;1,1]; b=[1/cos(x);1]; c=a*b; x=fzero( matlabFunction(c(1)-1) , pi/4 )

15 days ago | 0

| accepted

Answered
How can i speed up my code?
Please do not provide code in the form of embedded images. It prevents us from conveniently copy/pasting relevant sections. In ...

15 days ago | 0

| accepted

Answered
Get the diagonal without calculating the explicit matrix
Assuming B*C results in a square matrix, diagonal=sum(B.' .* C, 1);

15 days ago | 1

| accepted

Answered
Finding Area of Polygon defined by roipoly
roipoly returns a logical mask BW of the region BW = roipoly; so, its area in whole pixels would simply be area = sum(BW(:));...

16 days ago | 2

Answered
Setting nonlcon for fmincon / patternsearch as a matlabfunction
Create a wrapper function like the one below. To make it visible from the workspace where patternsearch is called, you can make ...

16 days ago | 1

| accepted

Answered
Use of kron with more than two matricies
One way would be to use my KronProd class https://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-...

16 days ago | 1

| accepted

Answered
How to find a minimal number of rows in a sparse matrix to form a square sub-matrix for a given row?
If you have the Optimization Toolbox, you can try this linear programming solution: A = [ -1 1 0 0 0 0 ...

19 days ago | 0

| accepted

Answered
How to plot a single variable function with constraints
You can assign NaN to anything you don't want plotted. Example, x=linspace(0,2,1000); f=sin(x); f( 0.5<=x & x<=1)=nan; p...

21 days ago | 0

Load more