Answered
3D/2D matrix multiplication without using a loop
Assuming S_r will always be square, B=reshape( S_r*A(:,:), size(A)); %B(:,:,k)=S_r*A(:,:,k)

5 years ago | 0

Answered
Constructor for a class, that accepts name-value pairs for setting properties
With a recent Matlab version, you can do, classdef classX properties Prop1, Prop3; end methods ...

5 years ago | 1

| accepted

Answered
Fast vector reshaping/permutation
Edit 2 for further context: ...Essentially this is the type of overall operation we are looking to do: This will be more effici...

5 years ago | 1

| accepted

Answered
Failure in initial objective function evaluation. FMINCON cannot continue.
The problem has nothing to do with fmincon. You must first make sure that your objective function runs without errors at x0.

5 years ago | 0

| accepted

Answered
how to ignore multiple clicks on buttun in matlab app designer
You can set the Interruptable property of the button to 'off' and the BusyAction property to 'cancel'. https://www.mathworks.co...

5 years ago | 0

| accepted

Answered
Least Trimmed Squares fitting
If you don't have too many unknown parameters to fit, you could implement it easily with fminsearch.

5 years ago | 0

| accepted

Answered
Row-wise individual circshift of a 3D-matrix without using a loop
%%% Precomputations - do this block only once [m,n,p]=size(A); [I,J,K]=ndgrid(1:m,1:n,1:p); %%% Jshift=mod(J-RowsShift-1,n...

5 years ago | 1

| accepted

Answered
Can I run multiple instances (say, 2) of matlab independently on the same computer, all using parfor and (ideally) different cores?
Does it make sense to run multiple scripts in different matlab instances? No, that would be a reinvention of what the Parallel ...

5 years ago | 1

Answered
These two sections of codes for getting the mean should give the same answer, but why don't they?
The first two elements differ by a very small amount. Likely just floating point noise.

5 years ago | 1

| accepted

Answered
Fast vector reshaping/permutation
No, permute() will be the fastest way (on the CPU). How does the GPU hurt other areas of your application?

5 years ago | 1

Question


On my Matlab Desktop UI is a minimize/maximize toggle button. I want minimization/maximization to occur only when I press this button.
I have configured my Matlab Desktop UI so that among the sub-panels displayed are the Command Window and the Workspace pane. I h...

5 years ago | 1 answer | 1

1

answer

Answered
Is there a way to access array elements returned by a function directly
In theory, it is possible to make a function directly indexable using OOP trickery, https://www.mathworks.com/matlabcentral/fil...

5 years ago | 0

Answered
Fitting cone/cylinder of known dimensions to 3D surface data
If you know where the given surface samples would be located on an unrotated/untranslated version of the cone/cylinder, then the...

5 years ago | 1

Answered
How do I answer this question?
Hint: a:b:c

5 years ago | 0

Answered
Problem with optimization function fcn2optimexpr
It is likely that you meant to do element-wise exponentiation .^ somewhere in your function, but have ^ instead.

5 years ago | 0

| accepted

Answered
Shape recognition from user input and obtain XYZ coordinates
I thought it would be a simple use of the bwboundaries function or regionprops() but I can't seem to do so. Assuming the shapes...

5 years ago | 0

Answered
How to divide an image into non-overlapping blocks size 4x4?
You can use sepblockfun https://www.mathworks.com/matlabcentral/fileexchange/48089-separable-block-wise-operations out =sepblo...

5 years ago | 0

Answered
Define a matrix in terms of kronecker product
n=3; e=ones(1,n); A=eye(n); B=kron(e,A); p=reshape(1:n^2,n,[]).'; C=kron(A,B); C=C(p,:)

5 years ago | 0

| accepted

Answered
Define a matrix in terms of kronecker product
n=3; I=eye(n); e=ones(1,n); z=zeros(1,n); C=cell(n,1); for i=1:n q=z; q(i)=1; C{i}=kron(kron(I,e),q); end ...

5 years ago | 0

Answered
Fitting cone/cylinder of known dimensions to 3D surface data
I've recently added a cone-fitting routine to this FIle Exchange package, https://www.mathworks.com/matlabcentral/fileexchange/...

5 years ago | 1

| accepted

Answered
Optimization least square approach
Shouldn't it be err = sum (real(error).^2) + sum(imag(error).^2) ; If so, then this is a linear least squares problem, and you...

5 years ago | 0

Answered
Fitting cone/cylinder of known dimensions to 3D surface data
I am providing a guess that is not too far from the original values. If so, it sounds like there is an error in your calculatio...

5 years ago | 0

Answered
Reducing every value of a matrice every time by the same value
This might be what you want, but as @Scott MacKenzie says you've left a lot of problem details and issues for us to guess, whil...

5 years ago | 0

Answered
Problem structure with LSQNONLIN set in optimoptions object still uses FMINCON
I don't think you can use the optimvar framework to launch lsqnonlin, because lsqnonlin does not take a scalar objective. You wi...

5 years ago | 0

| accepted

Answered
How to extract the Jacobian matrix from the given equation?
If EX and EY are positive definite, one solution is simply, J=chol(EY).'/chol(EX).' In general, there won't be a unique soluti...

5 years ago | 1

| accepted

Answered
Optimization problem with quadratic function
You can use isosurface() to plot and quadprog() to minimize.

5 years ago | 0

| accepted

Answered
anyway to find common tangent for two functions
The problem has 6 unknowns, the (xc,yc) coordinates of the circle center and the (x,y) coordinates of each point of tangency. Ea...

5 years ago | 0

Answered
how can we compare two columns for a particular value of another column?
Say A is the matrix of values. [~,uniqueRows]=unique(A(:,[1,4,5]),'rows') This will tell you which rows can be kept so as to ...

5 years ago | 0

| accepted

Answered
Can the matrix be displayed in a way other than imagesc, imshow, image or pcolor commands (similar to the plot command)?
One possibility is to use pgonCorners (which must be Downloaded) https://www.mathworks.com/matlabcentral/fileexchange/74181-fin...

5 years ago | 0

| accepted

Answered
Submatrix sum (but just on a section)
You can use sepblockfun (Download) A=rand(4914); B1=sepblockfun(A,[189,1],'sum'); %the results B2=sepblockfun(A,[1,189],'su...

5 years ago | 0

Load more