Answered
Maximum line length in houghlines
No, but you can discard the results that exceed the length you want, easily enough. lines = houghlines(BW,T,R,P,'FillGap',5); ...

5 years ago | 0

| accepted

Answered
Margin aound a shape
Yes, there is buffer(), https://www.mathworks.com/help/matlab/ref/polyshape.polybuffer.html

5 years ago | 0

| accepted

Answered
union of polyshapes, problem with collinearity
You just had a comma separated list in there by accident. The polyshapes must be given to union() as a vector. load(websave('t'...

5 years ago | 1

| accepted

Answered
reshape 8bit matrix to 16 bit matrix
A=[16 16 32 32 48 48 64 64]; B= A(:,1:2:end)*256 + A(:,2:2:end)

5 years ago | 0

Answered
How to create the specified matrix array?
[BB,AA]=ndgrid(B,A); D=[AA(:),BB(:),C(:)];

5 years ago | 1

| accepted

Answered
Populating an array with a vairable-output function
Use a cell array instead. fileBatch = {'File1','File2','...FileN'} for f = 1:length(fileBatch) OutputInformationTable{f} ...

5 years ago | 0

| accepted

Question


Incorrectly reported Func-count in lsqcurvefit. Also, MaxIterations not obeyed
In R2020b and R20201a, I have done the following test of lsqcurvefit. The test function below test(M) uses lsqcurvefit to solve ...

5 years ago | 1 answer | 0

1

answer

Answered
Problem in Curve fitting
Although polyfit is the better tool here, both polyfit and lsqcurvefit will be challenged by the scaling of your xdata, which is...

5 years ago | 1

| accepted

Answered
How to detect a disk and find the centre and radius?
Perhaps as follows, Image=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/624228/image.jpeg'); BW=Ima...

5 years ago | 0

Answered
Updating non linear constraints fmincon
and one of the constraints depends of one variable that is changing during the iterations If bat is changing with iterations, i...

5 years ago | 0

Answered
Change the first group of 0s in each column
c=cumsum(A,1,'omitnan'); A(c==0 & A==0)=3;

5 years ago | 0

Answered
Parfor: Converting broadcast variables into temporary variables or sliced variables
Temporary variables are not sent to the workers. They are created on the workers (and are destroyed there).

5 years ago | 0

| accepted

Answered
Change the first half of consecutive 1 in a column into 2
map=(A==1); C=cumsum(map,1,'omitnan'); A( C<=C(end,:)/2 & map) = 2;

5 years ago | 0

| accepted

Answered
Neighbour voxels of a list of voxels
If you have lists of xCoordinates, yCoordinates, and zCoordinates of the voxels, you may simply do, [dx,dy,dz]=ndgrid([-1,0,1])...

5 years ago | 0

| accepted

Answered
Optimizing a function with a vector as input
There is no reason why an OptimizationVariable can't be vector-valued, e.g., P=optimvar('P',[6,1]); size(P)

5 years ago | 0

| accepted

Answered
fastest way for multiplication of symmetric matrix and sparse matrix
If I use sparse matrix for A, the time to calculate A*P*A' is twice as if I use dense matrix for A. You have a strange compute...

5 years ago | 0

| accepted

Answered
The Convolution Theorem in 2D
The problem is that you need to zero-pad, A=rand(10); B=rand(10); szA=size(A); szB=size(B); szFull=szA+szB-1; result1 =...

5 years ago | 1

Question


Create listener for changes in position of a figure window
I have been trying to use addlistener() to make it so that when one figure window is moved, another figure window shifts positi...

5 years ago | 1 answer | 0

1

answer

Answered
How to see a 3D matrix with another point of view
Perhaps the view() command? https://www.mathworks.com/help/matlab/ref/view.html

5 years ago | 0

| accepted

Answered
Converting a function into an operator
A shortcut might be to use my MatrixObj class https://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly-definition-...

5 years ago | 1

Answered
Matrix to string, filled with zeros
B=compose('%.4d',A); C=cumsum( A(2:end)==0 & A(1:end-1)==9999 );

5 years ago | 2

Answered
How to produce frequency vector corresponding to FFT() samples?
[X,freqvec] = DFT(x,Fs); plot(freqvec,abs(X)) function [X,freqvec] = DFT(x,Fs) N = length(x); for k = 0:(N-1)...

5 years ago | 2

Answered
Optimally search for which positions a rectangle is within a polygon, faster way than using shapeID of union?
If the red shape is fixed and you want to do this test for a swarm of blue rectangles, a good strategy may be to decompose the r...

5 years ago | 1

| accepted

Answered
Is there a Multivariate PCHIP?
It will be somewhat faster to use griddedInterpolant() rather than interpn().

5 years ago | 1

| accepted

Answered
Not enough input arguments when i call fmincon constraint function with multiple input parameters to pass into
The constraint and objective functions should have one input argument. If you have N unknowns, they should be passed in as an N-...

5 years ago | 1

| accepted

Answered
How can I find exactly the coordinates of the center of the yellow circle?
regionprops3( true(size(yourImage)) ,yourImage, 'WeightedCentroid')

5 years ago | 2

Answered
Detect circles in an image
Use ObjectPolarity='dark'.

5 years ago | 0

Answered
How to find the volume of a region in a segmented image?
stats = regionprops3(segmentationMap,'Volume')

5 years ago | 0

Answered
Determine three model Parameters (least squares?)
lsqcurvefit would be appropriate, https://www.mathworks.com/help/optim/ug/lsqcurvefit.html

5 years ago | 0

| accepted

Answered
Non linear fit of multiple data set
Because of the constraints, I think you'll just have to do it by Monte Carlo simulation...

5 years ago | 0

Load more