Answered
Dot notation and curly braces with TABLE
In Matlab, there are circumstances in which indexed assignments will convert the type of the right hand side in order to be cons...

3 years ago | 0

Answered
Unwanted black background on a figure
I have no idea why it's like this. That seems to be the default color scheme, judging from this doc page, https://www.mathwork...

3 years ago | 1

| accepted

Answered
if loop to find values in a variable
One possibility t = [4 5 7 8 10 11 12 15 17 20 22 24 26 27 28]; Q = [1 3 4 1 5 8 4 2 6 1 4 2 8 3 5]; p = 10; np = 3; c ...

3 years ago | 0

Answered
Is there a way to speed up the computation of a piecewise defined function?
Use logical indexing, %Option 1.1 x=-10:10; y=x; y(x<=-5)=-2; p=abs(x)<5; y(p)=sin(x(p)); struct.x=x; struct.y=y;...

3 years ago | 0

Answered
After migrating from MATLAB 2020b to 2023a my cpp application can't load mcc DLL
It sounds like your code is linking to the 2020b Matlab Runtime, instead of the newer one. If you know how to adjust that, you p...

3 years ago | 0

Answered
Find values of two variables corresponding to query points of two matrices.
You should use fsolve or fminsearch to solve the original equations. Both of these are iterative solvers requiring an initial gu...

3 years ago | 0

Answered
fminbnd error in calculating of solar cell efficiency with detailed balance
Perhaps you meant to have, F = @(V) norm( V.*-q.*(Nabs - Fluxfunction(Eg, Egmax, Tc,V)) ); Otherwise, it is not clear how t...

3 years ago | 0

| accepted

Answered
Using different line style to generate plot
N = 10:20:500; err = rand(6,numel(N)); %fake h = loglog(N,err'); [h.LineStyle]=deal('-','--','-.',':','--','--'); [h(end-1...

3 years ago | 1

| accepted

Answered
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
Possibly mproc or one of its callers has path-altering commands that temporarily remove cmap from the path. To be certain, we wo...

3 years ago | 0

Answered
Error using pcread and pcshow
I wouldn't know how to do all the image processing and segmentation work that I could do in a simpler and more direct way with t...

3 years ago | 0

Answered
How do I fix "Index exceeds the number of array elements"?
Well, period=50 so x1(period+1:2*period) is the same as x1(51:100). Since x1 has length 50, indexing it from 51:100 won't work. ...

3 years ago | 0

Answered
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
So this specific line of code is just refusing to work for seemingly no reason. Maybe there is some invisible character in tha...

3 years ago | 0

Answered
Can I use parfeval in App Designer to plot to a UIAxes while the code keeps running?
A mechanism equivalent to .mat file saving is how data is transferred to parpool workers. The plotFcn that you give to parfeval ...

3 years ago | 1

| accepted

Answered
have an array of inputs instead of constants
Just concatenate all the constants into a vector and bring that into Simulink, constants=[m,alp_ang,...,MaxBrk]

3 years ago | 1

Answered
How can I find fitness values of optimized results in gamultiobj tool?
The fval output from gamultiobj should give you those values: [x,fval] = gamultiobj(___)

3 years ago | 0

Answered
How do I extract a structure array from a single dynamic structure without using for loops?
There is no way to avoid for-loop speed when dealing with structs and cells. Below is a way to abbreviate the syntax, but both n...

3 years ago | 0

| accepted

Answered
Plot 2d images into Cylindrical 3D image with degree increment
There are several applicable File Exchange contributions. Here are 2 of them, https://www.mathworks.com/matlabcentral/fileexcha...

3 years ago | 1

Answered
concatenate array of structures with same field names
So why is it that Matlab cannot use fread to read a structured file? Not sure how fread is implemented (does it use C++ fread or...

3 years ago | 0

| accepted

Answered
double conditional in one line
You need to be using '&' x=0.23; 0<x & x<1

3 years ago | 0

Answered
Extract pixels inside the area between 2 edge lines
[m,n]=size(I); mask=poly2mask(POLYOUT.Vertices(:,2),POLYOUT.Vertices(:,1), m,n); pixels=I(mask)

3 years ago | 0

| accepted

Answered
Minimum distance between 2 points
Use pdist2

3 years ago | 0

Answered
Concatenate string with table
writematrix(header,'filename.txt'); writetable(tab_data,'filename.txt',WriteVariableNames=false,WriteMode='append');

3 years ago | 0

| accepted

Answered
Vectorization/increase efficiency of nonconvex optimization problem using systematic initializations
It is not clear that a vectorized approach would help you, because the time for each of the optimizations to converge would be ...

3 years ago | 0

| accepted

Answered
Constants that cannot be delete with CLEAR
You could make the constants the Constant properties of a class. Then they can be reused even after issuing clear classdef myco...

3 years ago | 1

| accepted

Answered
Optimization not working because fitness function must be a function handle
problem.objective = ... @(x) [+0.0365*x(1) - 0.18*x(2) + 0.389; 0.0435*x(1) - 0.266*x(2) + 4.2*x(3) + 0.019*x(1...

3 years ago | 0

Answered
Add properties to edit field in app designer
It might be better to use a 3rd party tool like, https://www.mathworks.com/matlabcentral/fileexchange/19729-passwordentrydialog...

3 years ago | 0

| accepted

Answered
Add properties to edit field in app designer
You can always use the EditField's UserData property to hold extra stuff. However, there's no reason the true password needs to ...

3 years ago | 0

Answered
Scalar structure required for this assignment.
Your intention with the code is not clear, but here is one possibility, [Sis.On]=deal(D_{:,2});

3 years ago | 2

| accepted

Answered
Finding intersection of line(vector) and an unclosed shape
Use polyxpoly if you have the appropriate toolbox. Otherwise, use this FEX download, https://www.mathworks.com/matlabcentral/fi...

3 years ago | 0

Answered
how to calculate the area of each bin of intersection of a circle and mesh grid?
The efficient way would be to first eliminate the grid squares which are wholly inside or outside the circle, which you can dete...

3 years ago | 0

Load more