Answered
Discretizing a column array, and performing operations on elements of another column array of the same length that lie in the same bins as the original one
G=findgroups( discretize(Z,edges) ); Fbinned = splitapply(@(z) mean(z,1) , F, G);

2 years ago | 0

Answered
How to restrict tensorprod (with contraction) to only give certain results?
No, you cannot. pagemtimes is the appropriate solution.

2 years ago | 0

| accepted

Answered
different results with fmincon
function [c,ceq] = nonlcon(x,B,v) [~,difference]=fun(x,B,v); c=max(difference)-0.001; ceq=[]; end

2 years ago | 0

| accepted

Answered
Transform coordinates into pixel
Use getframe and writeVideo like in this example: https://www.mathworks.com/help/matlab/ref/videowriter.writevideo.html#mw_6dab...

2 years ago | 0

| accepted

Answered
Extracting tables within a cell.
when try to run a loop to extract these elements and have them written out the loop isn't going past the first cell and only re...

2 years ago | 0

Question


Why don't getframe RGB codes agree with plotted polyshape RGB codes?
In the code below, I have computed the RGB color code of the square as seen in both a polyshape plot (polyshapeRGB) and as seen ...

2 years ago | 1 answer | 0

1

answer

Answered
Locate two neighboring nodes in space so as to divide the matrix into two
load xydata xy %Original 3D data mapped to 2D xy=xy(tspsearch(xy,5),:); %tspsearch is on the file exchange P=polyshape(xy,...

2 years ago | 0

| accepted

Answered
Loading multiple structure from a folder
It is because not all of the sub-structures mydata(n).data have the same fields. If you contest that, attach the mydata variable...

2 years ago | 0

| accepted

Answered
Can a ROI shape (ie. a Rectangle made by drawRectangle()) be a property of a class?
You need to specify the complete class name: classdef device properties tag string shape images.ro...

2 years ago | 0

| accepted

Answered
How to create struct from fieldnames and values cell arrays for code generation ?
Does it support transpose for normal arrays? If so, then you might be able to do, list_fields = {'a'; 'b'; 'c'; 'd'}; % the fu...

2 years ago | 0

Answered
Four-parameters optimization of a 1D function: wrong values
I would recommend using fminspleas, https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas with INLP=[p2,p3,p4...

2 years ago | 0

| accepted

Answered
Solve for A matrix in Ax = 0
n=numel(x); mask=tril(triu(ones(n),-1),+1); %tridiagonal mask A=optimvar('A',[n,n]); prob = eqnproblem; prob.Equation...

2 years ago | 0

| accepted

Answered
negative value structural similarity index
A negative SSIM value means the values in those regions tend to be negatively correlated. When X goes low, then Y tends to go hi...

2 years ago | 0

| accepted

Answered
How to handle imagedatastore when input and response have different dimension?
Modify the trntf_input, trntf_label datastores' ReadFcn so that when it reads in the image, it wraps it in a 1x1 cell array. S...

2 years ago | 0

| accepted

Answered
How to plot 3D plane of surface with 3 coordinates data?
You can use planarFit, from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools...

2 years ago | 1

| accepted

Answered
Cure fitting - lsqnonlin
I initially inputted my guess, lower bound, and upper bound with the true optimized values obtained from a published paper. Surp...

2 years ago | 1

| accepted

Answered
What would be the equation of the following surface?
You could try fitting a 2D Gaussian surface to it, e.g., with this FEX download, https://www.mathworks.com/matlabcentral/fileex...

2 years ago | 0

Answered
Finding Transformation Matrix of a viewer3d object
I think the 3x4 camera projection matrix P would be, h=gca(); camz=h.CameraTarget-h.CameraPosition; camy=-h.CameraUpVector; ...

2 years ago | 1

| accepted

Answered
Uploading .mat files that contain nested structs into a datastore
This example shows how to use a fileDataStore to read partial data from a .mat file https://www.mathworks.com/help/matlab/ref/m...

2 years ago | 0

Answered
Which optimization tool should be used for solving my convex optimization problem?
If, as you seem to, you have a non-quadratic (and therefore also nonlinear) convex objective function, then you must use fmincon...

2 years ago | 0

Answered
Fixed-distance of legend outside plot axes
is there any "simple" parameter (i.e., not position) which controls the vertical distance between the legend box and the upper e...

2 years ago | 1

| accepted

Answered
the arc using the chord
Assume the chord is of length L and, with no loss of generality, assume also that it is aligned with the x-axis with end points ...

2 years ago | 1

Answered
Dot Multiplication in MATLAB
For matrices A and B, the rule is generally that A.* B is element-by-element multiplication a(i,j).*b(i,j), which means that nor...

2 years ago | 1

| accepted

Answered
Find paths in graph that satisfy specific condition
s=[17,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30]; t=[18,19,20,21,22,23,24,25,26,27,28...

2 years ago | 0

| accepted

Answered
Getting error in fmincon with below code how to correct it
You seem to be trying to minimize over a space of functionals, F. You cannot do that with fmincon. The objective must be a funct...

2 years ago | 0

Answered
How to plot a grouped bar chart?
https://www.mathworks.com/help/matlab/ref/bar.html#bthxce9

2 years ago | 1

| accepted

Answered
Subdivide a figure with a grid (as in Timescope)
Something like this, perhaps? t=tiledlayout(2,2); for i=1:4, nexttile(t), plot(rand(1,4)); grid on; end background=axes('Po...

2 years ago | 0

Answered
vectorized operations on symbolic functions
syms x1 x2 x3; % symbolic variables y = x1^3/3 + x2^2/2 - x3; % symbolic function y X = rand(500,3); % each row representing a...

2 years ago | 1

Answered
How to add an image to the current axes without replacing existing plots
You can use hold fcontour(@(x,y) (x-50).^2+(y-50).^2,[20,80],'m'); hold on imshow(imread('cameraman.tif')); hold off h=gc...

2 years ago | 0

Answered
Restart Fmincon Optimization from Checkpoint File
No, unfortunately. Restarting from the last point is probably the best you can do. Although, apart from the interior-point algor...

2 years ago | 0

| accepted

Load more