Answered

object detection in a binary image

>> bwimage=imbinarize(rgb2gray(imread('bwimage.jpg'))); >> locations=regionprops('table',~bwimage,'Centroid') locations = ...

object detection in a binary image

>> bwimage=imbinarize(rgb2gray(imread('bwimage.jpg'))); >> locations=regionprops('table',~bwimage,'Centroid') locations = ...

7 jours ago | 0

| accepted

Answered

Unique rows of 2 cells with 2 columns each.

I tried the following 2 codes: unique(vertcat(IdxMembers,IdxMembers2),'rows')... I get the unique values in dim (nr. of unique v...

Unique rows of 2 cells with 2 columns each.

I tried the following 2 codes: unique(vertcat(IdxMembers,IdxMembers2),'rows')... I get the unique values in dim (nr. of unique v...

8 jours ago | 0

| accepted

Answered

Mean matrix of different size matrices in one cell array

cellfun( @(a)mean(a(:)) , A)

Mean matrix of different size matrices in one cell array

cellfun( @(a)mean(a(:)) , A)

8 jours ago | 0

Answered

upper and lower curves

You can use the quantile command https://www.mathworks.com/help/stats/quantile.html to determine the upper and lower quartiles...

upper and lower curves

You can use the quantile command https://www.mathworks.com/help/stats/quantile.html to determine the upper and lower quartiles...

8 jours ago | 0

Answered

Adjust regionprops orientation in order to get 360 degree value.

theta = 90-Orientation assuming theta increases clockwise.

Adjust regionprops orientation in order to get 360 degree value.

theta = 90-Orientation assuming theta increases clockwise.

8 jours ago | 0

Answered

using lsqcurvefit with normalized error

This way I get a good fit but then I cannot plot the 95% confidence interval. fmincon doesn't return the Jacobian, but it does ...

using lsqcurvefit with normalized error

This way I get a good fit but then I cannot plot the 95% confidence interval. fmincon doesn't return the Jacobian, but it does ...

9 jours ago | 1

| accepted

Answered

fmincon is nonlinear constraints satisfied, then not satisfied when I include objective function

The algorithms of fmincon try only to satisfy the nonlinear and A,b,Aeq,beq constraints at convergence. They do not pledge to sa...

fmincon is nonlinear constraints satisfied, then not satisfied when I include objective function

The algorithms of fmincon try only to satisfy the nonlinear and A,b,Aeq,beq constraints at convergence. They do not pledge to sa...

9 jours ago | 0

Answered

Question about for loop problem

I don't see any mistakes (that's why posting your error messages and output is always a good thing), however, the whole thing ca...

Question about for loop problem

I don't see any mistakes (that's why posting your error messages and output is always a good thing), however, the whole thing ca...

9 jours ago | 0

Answered

How to find the indices that a point lays between?

Do you suggest another way? In case X is not increasing. If X,Y are non-monotonic, I would do [~,points] = pdist2([X(:),Y(:)],...

How to find the indices that a point lays between?

Do you suggest another way? In case X is not increasing. If X,Y are non-monotonic, I would do [~,points] = pdist2([X(:),Y(:)],...

9 jours ago | 1

Answered

How to find the indices that a point lays between?

find is inefficient. You should instead do, point1=discretize(xA,X); point2=point1+1;

How to find the indices that a point lays between?

find is inefficient. You should instead do, point1=discretize(xA,X); point2=point1+1;

9 jours ago | 0

Answered

Split array into multiple columns based on another array

result = splitapply(@(x) {x}, DHB_combine,index_combine);

Split array into multiple columns based on another array

result = splitapply(@(x) {x}, DHB_combine,index_combine);

9 jours ago | 0

Answered

how to plot a fitness or objective function with optimum values

Sounds like you want this? options = optimoptions('ga','PlotFcn',{'gaplotbestf','gaplotbestindiv'}); [x,fval] = ga(Objective...

how to plot a fitness or objective function with optimum values

Sounds like you want this? options = optimoptions('ga','PlotFcn',{'gaplotbestf','gaplotbestindiv'}); [x,fval] = ga(Objective...

10 jours ago | 0

Answered

Multi-objective optimisation using results from external simulation

MATLAB optimization solvers require that you provide a function which take a guess of your unknowns as input and return the quan...

Multi-objective optimisation using results from external simulation

MATLAB optimization solvers require that you provide a function which take a guess of your unknowns as input and return the quan...

10 jours ago | 1

Answered

Subset multidimensional array using a vector

idx=repmat({':'},1,ndims(A)); idx(1:numel(v))=num2cell(v); result=A(idx{:});

Subset multidimensional array using a vector

idx=repmat({':'},1,ndims(A)); idx(1:numel(v))=num2cell(v); result=A(idx{:});

10 jours ago | 1

Answered

Sorting and averaging matrices

[~,idx]=sort( reshape(A,8,[]) ,1); [m,n]=size(idx); C=reshape(B,m,n,[]); [m,n,p]=size(C); idx=i...

Sorting and averaging matrices

[~,idx]=sort( reshape(A,8,[]) ,1); [m,n]=size(idx); C=reshape(B,m,n,[]); [m,n,p]=size(C); idx=i...

10 jours ago | 2

| accepted

Answered

fmincon command to find minimum value of Rosenbrock's function in Polygonal domain

You have miscalculated your A and b. You can use vert2lcon to obtain them automatically, https://www.mathworks.com/matlabcentra...

fmincon command to find minimum value of Rosenbrock's function in Polygonal domain

You have miscalculated your A and b. You can use vert2lcon to obtain them automatically, https://www.mathworks.com/matlabcentra...

10 jours ago | 0

| accepted

Answered

Action shot function with multiple images

Yes, here is an approach that uses no loops, Image4D=double(cat(4,ImageCell{:})); MedianImage = median(Image4D,4); [~,idx...

Action shot function with multiple images

Yes, here is an approach that uses no loops, Image4D=double(cat(4,ImageCell{:})); MedianImage = median(Image4D,4); [~,idx...

11 jours ago | 3

| accepted

Answered

Undefined function for input arguments of type 'double': how do I make them vectors and not doubles?

Here is the non-symbolic approach mentioned by Adam. function[val,g,H]=givenfGNM(x) %givenf() modified to output the Hessian a...

Undefined function for input arguments of type 'double': how do I make them vectors and not doubles?

Here is the non-symbolic approach mentioned by Adam. function[val,g,H]=givenfGNM(x) %givenf() modified to output the Hessian a...

12 jours ago | 1

Answered

Removing object from image using median filter

I'll call your 1xn cell array of images ImageCell. Then I think you want, Image4D=cat(4,ImageCell{:}); R=median( Image4D(:,:...

Removing object from image using median filter

I'll call your 1xn cell array of images ImageCell. Then I think you want, Image4D=cat(4,ImageCell{:}); R=median( Image4D(:,:...

12 jours ago | 2

| accepted

Answered

Avoiding local minimum with fmincon

So my question is: Is there any way to avoid local minimum using fmincon or fminunc? There is no systematic, problem-independen...

Avoiding local minimum with fmincon

So my question is: Is there any way to avoid local minimum using fmincon or fminunc? There is no systematic, problem-independen...

12 jours ago | 2

Answered

Could anyone help me how to solve the issue.

[m,n]=size(a); differences=reshape(a,m,1,n) - reshape(a,1,m,n);

Could anyone help me how to solve the issue.

[m,n]=size(a); differences=reshape(a,m,1,n) - reshape(a,1,m,n);

13 jours ago | 1

| accepted

Answered

which way to call function is better?

I have more than hundred of input parameters in myfunc and I am using the following way to call the function after grouping the ...

which way to call function is better?

I have more than hundred of input parameters in myfunc and I am using the following way to call the function after grouping the ...

13 jours ago | 0

Answered

fmincon gradient of nonlinear inequality constraints must have size???

What is mysterious about the error message? It has told you that your gradc output has to be 4x12 and in your NLC2 you clearly o...

fmincon gradient of nonlinear inequality constraints must have size???

What is mysterious about the error message? It has told you that your gradc output has to be 4x12 and in your NLC2 you clearly o...

13 jours ago | 0

Answered

What is the best way to store groups of 3 nearest non-zero pixels?

I would like to identify and store each set of 3 closest points (as seen in the attached image) in a separate variable. No, you...

What is the best way to store groups of 3 nearest non-zero pixels?

I would like to identify and store each set of 3 closest points (as seen in the attached image) in a separate variable. No, you...

14 jours ago | 0

| accepted

Answered

matrix multiplication for "3-D" matrices

result=nan(2,2,100); result(1,1,:)=a11.*b11 + a12.*b21; result(1,2,:)=a11.*b12 + a12.*b22; result(2,1,:)=a21.*b11 + a22.*b2...

matrix multiplication for "3-D" matrices

result=nan(2,2,100); result(1,1,:)=a11.*b11 + a12.*b21; result(1,2,:)=a11.*b12 + a12.*b22; result(2,1,:)=a21.*b11 + a22.*b2...

14 jours ago | 0

| accepted

Answered

More than 580 billion possibilities

Sure, for example, count=0; for i=1:580*1e9 possibility=rand; if possibility>0.5 count=count+1...

More than 580 billion possibilities

Sure, for example, count=0; for i=1:580*1e9 possibility=rand; if possibility>0.5 count=count+1...

14 jours ago | 0

| accepted

Answered

GPU optimization of looped vector operations

This modification uses mat2tiles from the File Exchange, to help divide the computation into bigger, vectorized chunks https://...

GPU optimization of looped vector operations

This modification uses mat2tiles from the File Exchange, to help divide the computation into bigger, vectorized chunks https://...

14 jours ago | 1

| accepted