Answered
How to convert cell to matrix
cell2mat should have worked A=num2cell(rand(100001,2)); whos A B=cell2mat(A); whos B

5 years ago | 0

Answered
Function findobj does not find an object (?)
h = findobj(gcf,'Type', 'Scatter');

5 years ago | 0

Answered
Why the amplitude of Ram-Lak filter is multiplied by 2 in iradon transform?
Perhaps it is different from what you expect because the backprojection sums only from 0 to 180 degrees. If you summed from 0 to...

5 years ago | 0

Answered
How can i call the first point that appears in a matrix with a certain value?
A=[1 2 3; 4 5 6;7 6 9;6 4 7;9 0 10;3 4 6]; [~,firstappearance]=max(A==6)

5 years ago | 0

Answered
achieving a weighted inpolygon function
If the cells and the study region are represented by polyshape objects, https://www.mathworks.com/help/matlab/ref/polyshape.ht...

5 years ago | 1

| accepted

Answered
Remove Zeros Matrix on 3D Matrix
val = val(:,:, any(val,[1,2]) )

5 years ago | 0

| accepted

Answered
Global Optimizationproblem using Global Search
In fact, the problem can also be solved with quadprog, since it is equivalent to, min -10*x(1)+x(1)^2-4*x(2)+x(2)^2 s.t. 3x(...

5 years ago | 1

Answered
Global Optimizationproblem using Global Search
We can verify that Torsten's solution is feasible as below. Since it gives a better objective function value than your experime...

5 years ago | 1

| accepted

Answered
Solve multiple non-linear equations with vector variables
But it's not difficult to solve this 2-equation system for X and Y. I thought your equations were much harder. And in fact, the...

5 years ago | 0

| accepted

Answered
Counting number of digits after the decimal points
If the input is in string form, num="1.26500"; %input s= fliplr( char( extractAfter( num,'.') )) numel(s)- sum(find(s~='...

5 years ago | 0

Answered
Counting number of digits after the decimal points
If the input is numeric, num=1.26500; s= char( extractAfter( string(num),'.') ) length(s)

5 years ago | 0

Answered
Solve multiple non-linear equations with vector variables
A=[20,5]; B =[12,3]; XY0=ones(2); %initial guess [XY,fval]=fsolve(@(XY) Equations(XY, A,B) , XY0); X=XY(:,1), Y=X...

5 years ago | 0

Answered
Fit ellipse to objects in image
T=regionprops('table',~BW,'MajorAxisLength','MinorAxisLength','Eccentricity'); meanEccentricity=mean(T.Eccentricity); Area...

5 years ago | 2

Answered
Fit ellipse to objects in image
You cna use ellipticalFit(), distributed here: https://www.mathworks.com/matlabcentral/fileexchange/32108-fitting-a-conic-to-a-...

5 years ago | 1

Answered
Performing an Operation on a Matrix Using Complex Numbers
sz=size(a); C=2*atan(a(:),a(:).'); result=reshape( exp(1j*C), [sz,sz]);

5 years ago | 1

Answered
Performing an Operation on a Matrix Using Complex Numbers
sz=size(a); C=(a(:)-1i*a(:).'); result=reshape(C./conj(C) , [sz,sz]);

5 years ago | 1

| accepted

Answered
How to extract data from 6D data?
yourMatrix(i,j,k,:,:,:)

5 years ago | 0

Answered
How can I color all objects as the same in an image where several objects have been extracted in the form of a label matrix?
Bianrize the labels, RGB_label-label2rgb(labeled>0,___); imshow(RGB_labels);

5 years ago | 0

Answered
Parallel pool goes idle instantly in parallel GA
It sounds like you'll need to send your code to tech support in a bug report.. As a temporary workaround, set UseVectorized to...

5 years ago | 0

| accepted

Answered
FMINCON Parallel Pool goes idle after first iteration.
Does it happen only for this specific optimization problem, or for every problem? In any case, a workaround might be to set Sp...

5 years ago | 0

Answered
How to iterate through all combinations within a FOR loop?
Here's a dynamic programming approach: roll_list = [10 12 15; 3 1 2]; part_list = [7 6 6 5 4 7 5 4 6 5]; roll_list=sortro...

5 years ago | 0

| accepted

Answered
How to determine the 3D points if the ray intersects the the voxel that is perpendicular to Y axis?
You can find ray/box intersections using intersectionHull in this File Exchange package https://www.mathworks.com/matlabcentral...

5 years ago | 0

Answered
FMINCON showing x0 not between lb and ub, though my x0 is strictly between limits.
That might happen if you have additional, tighter box bounds encoded into your linear inequality constraint matrices A,b..For ex...

5 years ago | 0

Answered
find the equal values that stand together on the same row or column or diagonal in the matrix
e=ones(1,5); I=eye(5); bool=false; for i=1:2 mask=(m==i); bool=bool | any( conv2(mask,e ,'valid' )>=5 ,'all')...

5 years ago | 1

| accepted

Answered
ifft2 on GPU array
I think you should probably just omit the 'symmetric' flag. On the GPU (mine at least), it doesn't seem to make a big difference...

5 years ago | 1

| accepted

Answered
How can I use the "diff" function instead of a for loop?
[m,n]=size(ssh); zm=zeros(m,1); zn=zeros(1,n); gf=g./(2*omega*sind( lat ) ); Du=diff(ssh(:,2:end),1,2)+diff(ssh(:,1:end-...

5 years ago | 0

| accepted

Answered
Affine Transformation matrix estimation gives inconsistent result with MATLAB
These were mixed up: matchedOriginal = movingPoints; matchedDistorted = fixedPoints; Also, you loaded your affineParam(i) el...

5 years ago | 0

| accepted

Answered
Find closest point between two sets of points
One way is to use scattered interpolation. F=scatteredInterpolant(xA,yA,cA); result=0.5*( F(xB,yB)+cB); %average the inte...

5 years ago | 0

| accepted

Answered
Affine Transformation matrix estimation gives inconsistent result with MATLAB
Your algebraic method estimates a general 6DOF affine transform, whereas your call to fitgeotrans requests a non-reflective simi...

5 years ago | 0

Answered
Write Similar Expressions in Arrayfun
n=numel(X); r=1./[X(:),Y(:),Z(:),R(:)].'; rt=reshape(r,4,1,[]); out= squeeze( sum( (rt-r)./(rt+r) ,2)/n ).'; out=...

5 years ago | 1

| accepted

Load more