Answered
Trying to count the number of pixels in an image over a specific RBG value
results.area=nnz(imstd>90);

5 years ago | 0

| accepted

Answered
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))

5 years ago | 0

Answered
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);

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
How to construct a "ones" matrix with zero blocks in the diagonal
repelem(1-eye(4),4,4)

5 years ago | 1

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 1

| accepted

Answered
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

5 years ago | 1

| accepted

Answered
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 ...

5 years ago | 0

Answered
How can I call a script within a for loop, looping over multiple files?
result = scriptname(ID{nSubject},Visit{nVisit});

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
Number of branches per branch point
Perhaps as follows: k=ones(3); k(5)=0; neighborCount=conv2(double(BW),k,'same'); neighborCount=neighborCount.*(neighborCo...

5 years ago | 0

| accepted

Answered
Rank deficient error.
Are you attempting to do matrix division? if not use ./ instead.

5 years ago | 1

| accepted

Answered
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,...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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,[],[],[],[],...

5 years 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...

5 years ago | 1 answer | 1

1

answer

Answered
Find elements from a submatrix in the main 3D matrix
[row,col]=find( reshape( ismember(M(:),A(:)) , size(M) ) );

5 years ago | 1

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 1

Answered
Calculating efficiently the euclidean distance
In recent Matlab, you can just do, vecnorm(A(:, 1:2) - A(:, 3:4),2,2); In less recent Matlab, you can do, sqrt(sum( (A(:, 1:...

5 years ago | 1

| accepted

Answered
How to map subdivisions in a squared geometry
I can't tell from your code what the rules are that determine which cells are connected to or interact with other cells. However...

5 years ago | 0

Answered
Confusing about applying weighted least square for constant fitting
I would recommend lscov p=lscov(x(:).^[1,0],y,w/N); yfit=polyval(p,x)

5 years ago | 0

| accepted

Answered
How to run a matlab function using a button pushed in AppDesigner
The typical way would be to invoke addition() from your callback the way you would from any ordinary function, function Execute...

5 years ago | 1

| accepted

Answered
How to generate a connection graph with vertices and edges
I don't know if you even need a for-loop. You should probably just build a graph object using one of the syntaxes listed in the ...

5 years ago | 1

| accepted

Answered
Delete the line that are repeated
what I want to do is to delete from the old strings the lines that are in the new one. For example, oldstring=["dog"; "fish"; ...

5 years ago | 0

Answered
Get coefficients of variables in constraints (solver-based approach)
Yes, you can use prob2struct or prob2matrices: https://www.mathworks.com/matlabcentral/fileexchange/74481-prob2matrices-a-sele...

5 years ago | 2

| accepted

Load more