Question

Colormap Editor, a "fixed" bug leads to other bugs?

In R2020a on windows 10, if you adjusted the system scaling factor, e.g. to 125%, then every time you open Colormap Editor, it w...

1 day ago | 0 answers | 0

Question

Under what circumstance, mex-version of lsqcurvefit run slower than m-code of lsqcurvefit？

I converted a function to mex using Coder, which contains lsqcurvefit() to get some speedup. But this mex-version is slower than...

16 days ago | 0 answers | 0

Question

Use coder to convert parfor-loop to mex, but mex version is much slower

I convert a function containing a parfor-loop into a mex file to get some speed up. But the mex version of this function is 5x t...

18 days ago | 0 answers | 0

Question

Will codegen accelerate sub-functions?

I have functions look like % main.m function main() for i fun1(); end % fun1.m function fun1() for j fun2() ...

18 days ago | 1 answer | 0

Answered

Handling bound constraints by the Levenberg-Marquardt algorithm

In matlab2020b, the doc of lsqcurvefit() has removed "The Levenberg-Marquardt algorithm does not handle bound constraints". So ...

Handling bound constraints by the Levenberg-Marquardt algorithm

In matlab2020b, the doc of lsqcurvefit() has removed "The Levenberg-Marquardt algorithm does not handle bound constraints". So ...

19 days ago | 0

Answered

What is the alternate to eval function in a forloop?

Using cell array should help for i for j for k I{i,j,k}=getsiganl(filename1); II{i,j,...

What is the alternate to eval function in a forloop?

Using cell array should help for i for j for k I{i,j,k}=getsiganl(filename1); II{i,j,...

24 days ago | 0

Answered

How to get Data type of workspace loaded variables and how add that datatypes using script?

s=whos; numBytes = sum([s.bytes]);

How to get Data type of workspace loaded variables and how add that datatypes using script?

s=whos; numBytes = sum([s.bytes]);

1 month ago | 1

Answered

Save and load variables of different samples

You could try cell(). You do not have to save the variable names. c = cell(1,1); % each col contains variables of a sample, eac...

Save and load variables of different samples

You could try cell(). You do not have to save the variable names. c = cell(1,1); % each col contains variables of a sample, eac...

1 month ago | 0

Question

codegen can't build the simplest demo

I am using codegen to build the 1st example in its doc, i.e. mcadd.m, it did not work. I am running Maltab2020a on CentOs 8.3. ...

2 months ago | 0 answers | 0

Question

Call mex function using system()?

I downloaded a toolbox, which contains a pre-compiled mex file, foo.mexa64. The calling syntax is a little bit confusing, but ...

2 months ago | 1 answer | 0

Question

How to customize callback after drag and drop a folder into command window?

For files, it is easy to customize a callback after drag and drop file into command window, as shown here. However, for folders...

4 months ago | 0 answers | 0

Question

Using Matlab coder with lsqcurvefit(), can not pass optimoptions as an argument to the target function

I want to convert my function to mex using matlab coder. The function fits data to an exponential model. function ab_fitted = m...

4 months ago | 1 answer | 0

Question

How does vectorized lsqcurvefit() calculate sum-of-square, row-wise or column-wise?

I have a 1001 measuments, in each measurement, there is a curve y = a*exp(-b*x) where x and y are vectors containing 8 element...

4 months ago | 1 answer | 0

Question

In parfor-loop, can I call a multi-threaded mex and get some speed-up?

I learned the concept of multi-threaded mex from undocumentedmatlab. (It seems this website is unaccessible now ...) I am wonde...

4 months ago | 1 answer | 0

Question

Mex, how to copy an array to output

In my mex function my_expm.c, I calculated matrix expoential for the input matrix, void mexFunction(int nlhs,mxArray *plhs[], i...

5 months ago | 1 answer | 0

Question

With mxMalloc() and mxSetDoubles(), mex function crash matlab

I try to build a mex interface for a C function r8mat_expm1() that calculates matrix exponential, double *r8mat_expm1 ( int n, ...

5 months ago | 3 answers | 1

Question

Mex, how to make visual studio support C11 standard?

I am building a mex function from c language, which uses a non-standard data type, i.e. double complex, double complex *my_f...

5 months ago | 1 answer | 0

Question

Remove duplicates only for specific values

A = [1,2,2,3,3,4,5,5,5,6]; value_to_remove = [2,3]; I have an array A, which contains some duplciates. I want to remove part o...

5 months ago | 1 answer | 0

Question

During parfor-loop, suddenly get the error "unable to read file"

parfor k = 1:100000 % something else tmpStruct = load(filename); % something else end I have 3 scripts like the...

5 months ago | 0 answers | 0

Question

Parallel computing, occasionally get Exception message "Message Catalog MATLAB:load was not loaded from the file"

I am running two jobs on a cluster, job1 on node1, job2 on node2. Job1 starts a little bit earlier than job2. Everything is fin...

5 months ago | 1 answer | 0

Question

How can I run parallel job on a specific node?

I have access to a cluster, which contains several nodes, node01,node02, etc. The administrator has configured the Slurm profile...

5 months ago | 1 answer | 0

Question

Can I set MarkerFaceColor to part of the data points?

plot(1:10,1:10,'s') Can I set MarkerFaceColor to red for point 1,2,3 while leave the other points unchanged? I tried in intera...

5 months ago | 1 answer | 0

Answered

A moving point along a graph.

Although this is an old thread, in case someone needs, trace-marker-along-line

A moving point along a graph.

Although this is an old thread, in case someone needs, trace-marker-along-line

6 months ago | 0

Answered

How to open the file of type Mn.

This should be helpful. MATLAB File Association & Shortcut Fix

How to open the file of type Mn.

This should be helpful. MATLAB File Association & Shortcut Fix

7 months ago | 0

Answered

How to find a constrained sum within a region

You can do this in a binary search manner, instead of doing sum() stepwise. Below is pseudo code diameterMin = 0.001; % choo...

How to find a constrained sum within a region

You can do this in a binary search manner, instead of doing sum() stepwise. Below is pseudo code diameterMin = 0.001; % choo...

8 months ago | 0

Answered

How do you populate a struct with multiple loaded .mat files?

There is a contradiction between your statement and your comment in code. I assume you are asking about " however when I wrap it...

How do you populate a struct with multiple loaded .mat files?

There is a contradiction between your statement and your comment in code. I assume you are asking about " however when I wrap it...

8 months ago | 0

| accepted

Answered

Understanding MatLab's built-in SVM cross-validation on fitcsvm

Maybe kfoldLoss uses a different definition of loss than yours. Your definition is 1-accuracy. https://www.mathworks.com/help/...

Understanding MatLab's built-in SVM cross-validation on fitcsvm

Maybe kfoldLoss uses a different definition of loss than yours. Your definition is 1-accuracy. https://www.mathworks.com/help/...

8 months ago | 0

Answered

Find indicies of k smallest matrix elements

[~, indices] = sort(A(:), 'ascend'); ind = indices(1:k);

Find indicies of k smallest matrix elements

[~, indices] = sort(A(:), 'ascend'); ind = indices(1:k);

8 months ago | 0

| accepted

Answered

Function with two outputs only giving one output

Apparently, the code is right. I assume you are new to matlab. You should use [C K] = FTOCK (degreeF) to receive two out...

Function with two outputs only giving one output

Apparently, the code is right. I assume you are new to matlab. You should use [C K] = FTOCK (degreeF) to receive two out...

8 months ago | 0

Answered

When I run the file I get an error

You should provide a reproducible snippet. I copy your code and run, it turns out "Unrecognized function or variable 'f'." at li...

When I run the file I get an error

You should provide a reproducible snippet. I copy your code and run, it turns out "Unrecognized function or variable 'f'." at li...

8 months ago | 0