Answered
How best and most efficient way to build this matrix
[C,R]=deal(zeros(1,10)); C(1:4)=[-4 6 -4 1]; R(1:2)=[-4,1]; A=toeplitz(C,R); A(1)=-2; A(end,:)=flip(A(1,:))

2 years ago | 0

| accepted

Answered
how concatenate arraycell in this strange way
c = {1 4}; d = {3 6}; num2cell( [cell2mat([c;d]')],2)'

2 years ago | 0

| accepted

Answered
Is there a good way here to allow users to both retain access control for properties and overload indexing methods?
then the access property of that member becomes invalid at that point Nope, not true. Even if you don't define a subsref method...

2 years ago | 0

| accepted

Answered
Register the point cloud data sets
Have you looked at this, https://www.mathworks.com/help/vision/ug/3-d-point-cloud-registration-and-stitching.html#StitchPointCl...

2 years ago | 0

| accepted

Answered
Sum up meshgrids with different sizes and positions that overlap each other
Rather than using handle graphics to do this, it sounds like it would be better to use imrotate to make the various rotations of...

2 years ago | 0

Answered
Max Pooling Layer Tuning
Your input image's spatial dimensions are 6x1. This is not compatible with a 2x2 maxpooling filter. Did you mean to have 2x1 poo...

2 years ago | 1

| accepted

Question


Import desktop layouts into a newer release of Matlab
I have created and saved two personalized layouts for my Matlab Desktop, Now, ho...

2 years ago | 1 answer | 0

1

answer

Answered
How do I validate an input method input by a object property?
classdef myclass properties(Access=public) Filenames cell {mustBeA(Filenames,"cell")} = {['Testrun_xxxx']} ...

2 years ago | 1

| accepted

Answered
Why doesn't parfeval(@splitapply) improve splitapply's performance?
It probably means that Matlab's internal parallellization already does what parfeval does.

2 years ago | 0

| accepted

Answered
extremely inefficient piece of code ... bug?
Well, I think the bottom line is just that the JIT does not have any optimization for indexing expressions like idx(idx<=0). Tha...

2 years ago | 0

| accepted

Answered
How to create an indexable array of fid
fids are just numbers. You can allocate any double array to hold them.

2 years ago | 0

Answered
Why is sum considerably slower that adding each individual element together, when using large loops?
Yes, unfortunately, vector indexing is quite an expensive operation. If idx is constant, as in your example, than you should do ...

2 years ago | 1

| accepted

Question


Why is it necessary/useful to have a HandleCompatible attribute?
Setting HandleCompatible=true in a value class doesn't seem to change its behavior in any way, other than to allow it to "mate" ...

2 years ago | 2 answers | 1

2

answers

Answered
When I use fmincon, the optimised result does not satisfy my non liner constraints
Since it is a 2D problem, it practically begs you to pre-sweep for a good initial guess: fun = @(x)4*x(1)+x(2); lb = [0.01,0...

2 years ago | 0

Question


More multiplication operations require less time
I would expect the execution times for the 3 operations below to get longer and longer. Where have I misled myself? Is it an iss...

2 years ago | 1 answer | 0

1

answer

Answered
How can I disable fminsearch function to print a warning message?
fminsearch(___, optimset('Display','off'))

2 years ago | 1

| accepted

Answered
Reshaping with Different Sizes
There is no requirement that an index array be the same size as the array being indexed. Example: values=[20,30,40] values(o...

2 years ago | 1

| accepted

Answered
Optimizing the coefficients of basis functions to fit a curve
You don't need any special curve fitting tool. Due to the linearity of the model, the coefficients can be found using mldivide, ...

2 years ago | 2

| accepted

Question


CPU-gpuArray transfer speeds on modern GPUs
For a long time, the conventional wisdom has been that, when computing on the GPU, one should try to minimize CPU-GPU transfers,...

2 years ago | 0 answers | 2

0

answers

Answered
Filling some of the 2d matrix arrays with having vector's indexes
Using accumarray, probably. However, you haven't described what values A(I,J) are supposed to be filled with and the role of my_...

2 years ago | 0

Answered
Interpolate data between two specified contours
We don't know in what form your input data exists. Most of the contour plotting functions allow you to specify the isocontour le...

2 years ago | 0

Answered
Why does my subtraction yield different results?
isequal(eps(x),eps(x_test))=1 does not establish that x=x_test. You misunderstand what eps() does. eps(1) eps(1.1) isequal(...

2 years ago | 1

| accepted

Answered
How can I combine two double arrays into one but in different rows and columns within Matrix
A = [0;0;0;1;1;1;2;2;2]; B = [5,6,7,8;1,2,3,4;0,1,2,3]; b=B(:,2:end)'; C=[A(:),b(:)]

2 years ago | 0

| accepted

Answered
What exactly are Handle Compatible Classes? Are they a combination of handle and non-handle classes?
I found that the objects defined by A do not belong to any class! Why is this happening? The syntax of of isa() is, isa(object...

2 years ago | 1

| accepted

Answered
NONLCON must be a function using lsqnonlin
No, you have set the nonlcon argument to Cexp which is a numeric vector. You should review the documentation for the correct ord...

2 years ago | 0

| accepted

Answered
Counting zeros which are lying between nonzero elements by considering consecutive zeros as a single element in a matrix
A=[1 0 1 1 1 0 0 1;0 1 0 1 1 0 1 0;0 0 1 0 0 0 0 0;1 0 1 1 0 0 1 1] d=diff(A,1,2); result= max(0, min( sum(d==-1,2) - ~A(:,...

2 years ago | 0

Answered
Is there a way to have C1 continuous curve fit?
You could use this spline fitting tool: https://www.mathworks.com/matlabcentral/fileexchange/24443-slm-shape-language-modeling ...

2 years ago | 1

Answered
What functions need GPU support
Sparse array indexing would be one example, e.g >> A=gpuArray.speye(5) A = (1,1) 1 (2,2) 1 (3,3)...

2 years ago | 0

Answered
How can I have similar left side starting point for multiple plots on tiledlayout?
You can use xlim to set where you want each plot to begin.

2 years ago | 0

Answered
inline function returning multiple output variables
A wrapper is needed. tdata = table(["US";"US";"US";"UK";"UK";"TW";"TW";"TW";"TW"], [1;1;5;1.20000000000000;3;4;5;1;2],'Variable...

2 years ago | 0

| accepted

Load more