Answered

How to write my Matlab code so that its standalone application program takes multiple input files?

It should work just as you've shown. Just write your mcode to accept input arguments as you would write a non-deployed mfile. Se...

How to write my Matlab code so that its standalone application program takes multiple input files?

It should work just as you've shown. Just write your mcode to accept input arguments as you would write a non-deployed mfile. Se...

14 días ago | 0

| accepted

Answered

Optimization function needs to integrated in problem

No, it's just a linear equation. Expand the ln() into two terms and rewrite as σ=σ_W+kT/(rS_W )* ln((1-Ka_s) - kT/(rS_W )*ln...

Optimization function needs to integrated in problem

No, it's just a linear equation. Expand the ln() into two terms and rewrite as σ=σ_W+kT/(rS_W )* ln((1-Ka_s) - kT/(rS_W )*ln...

15 días ago | 0

Answered

How can I fill everything below the white thing line in this image?

By adapting the following smaller example, A = 1 0 0 0 0 0 0 0 0 1 0 0 ...

How can I fill everything below the white thing line in this image?

By adapting the following smaller example, A = 1 0 0 0 0 0 0 0 0 1 0 0 ...

15 días ago | 0

| accepted

Answered

Randi(imax,m,n)

Perhaps as follows, num = uint64(randi(2^53-1,1))*2^8 +randi(2^8-1,1)

Randi(imax,m,n)

Perhaps as follows, num = uint64(randi(2^53-1,1))*2^8 +randi(2^8-1,1)

15 días ago | 0

Answered

Optimization solver equality constraints

You can use quadprog https://www.mathworks.com/help/optim/ug/quadprog.html

Optimization solver equality constraints

You can use quadprog https://www.mathworks.com/help/optim/ug/quadprog.html

16 días ago | 0

Answered

Making Pairs of Indices in Matrix- Pairwise Function

It depends what Matlab data-type you consider to be the equivalent of a Python tuple. I tend to think of cell arrays as the equi...

Making Pairs of Indices in Matrix- Pairwise Function

It depends what Matlab data-type you consider to be the equivalent of a Python tuple. I tend to think of cell arrays as the equi...

16 días ago | 0

| accepted

Answered

I have two matrices and I would like to create a matrix containing the above threshold value of each element of both matrices

Another way, result=matrix2; idx=(matrix2<threshold); result(idx)=matrix1(idx);

I have two matrices and I would like to create a matrix containing the above threshold value of each element of both matrices

Another way, result=matrix2; idx=(matrix2<threshold); result(idx)=matrix1(idx);

17 días ago | 0

Answered

How to continue while loop if NaN value is present in cell array

Since all your arrays C{j} are the same size, it seems unnecessary to carry the data around in a cell array at all. You could ju...

How to continue while loop if NaN value is present in cell array

Since all your arrays C{j} are the same size, it seems unnecessary to carry the data around in a cell array at all. You could ju...

17 días ago | 1

| accepted

Answered

I have two matrices and I would like to create a matrix containing the above threshold value of each element of both matrices

Is this possible without for loops? Yes. One way is as follows: mask=(matrix2>=threshold); result = matrix2.*mask + matrix1...

I have two matrices and I would like to create a matrix containing the above threshold value of each element of both matrices

Is this possible without for loops? Yes. One way is as follows: mask=(matrix2>=threshold); result = matrix2.*mask + matrix1...

17 días ago | 0

| accepted

Answered

Matrix Indexing and manipulations

[A_matrix([1 2 1 4 1 2],:) , A_matrix([2 3 3 3 3 4],:)]

Matrix Indexing and manipulations

[A_matrix([1 2 1 4 1 2],:) , A_matrix([2 3 3 3 3 4],:)]

17 días ago | 0

| accepted

Answered

Interpolation code. How can I deal with a strange problem.

Looks like a simple, 2x2 linear equation system to me. >> w=[1, 0;1,0.93]\[16;3] w = 16.0000 -13.9785

Interpolation code. How can I deal with a strange problem.

Looks like a simple, 2x2 linear equation system to me. >> w=[1, 0;1,0.93]\[16;3] w = 16.0000 -13.9785

18 días ago | 0

Answered

Why is a Number Divided by Itself Not Equal to Unity?

It depends what algorithm is used to perform complex division x./y. For example, if it is implemented as x./abs(y).^2.*conj(y), ...

Why is a Number Divided by Itself Not Equal to Unity?

It depends what algorithm is used to perform complex division x./y. For example, if it is implemented as x./abs(y).^2.*conj(y), ...

18 días ago | 1

Answered

lsqcurvefit - Error using Data_fit>@(x)myfun2(x,xdata) Too many input arguments.

The second call to lsqcurvefit should be, ___ = lsqcurvefit(@E_fn,x0,xdata,ydata,lb,ub); or ___ = lsqcurvefit(myfun2,x0,xdata...

lsqcurvefit - Error using Data_fit>@(x)myfun2(x,xdata) Too many input arguments.

The second call to lsqcurvefit should be, ___ = lsqcurvefit(@E_fn,x0,xdata,ydata,lb,ub); or ___ = lsqcurvefit(myfun2,x0,xdata...

19 días ago | 0

| accepted

Answered

what is wrong in this? how to use isinteger?

To test whether a variable is integer-valued, you would do y==round(y) isinteger is for something completely different. It sim...

what is wrong in this? how to use isinteger?

To test whether a variable is integer-valued, you would do y==round(y) isinteger is for something completely different. It sim...

19 días ago | 0

| accepted

Answered

How to find the position of a number in an array?

There is nothing wrong with your code as long as there are elements in Y that are exactly equal to 8 >> Y=[8 1 2 5 8 6]; >> k=...

How to find the position of a number in an array?

There is nothing wrong with your code as long as there are elements in Y that are exactly equal to 8 >> Y=[8 1 2 5 8 6]; >> k=...

19 días ago | 0

Answered

Optimization tool: How to enable for changeable number of objective function variables?

The only time it makes sense to take the approach posted in your question is when the cost function evaluation can be simplifie...

Optimization tool: How to enable for changeable number of objective function variables?

The only time it makes sense to take the approach posted in your question is when the cost function evaluation can be simplifie...

20 días ago | 0

Answered

Parameter conditions in ga

I need the following condition to be true: cond = a>b; The 3rd and 4th input arguments to ga let you specify arbitrary linear c...

Parameter conditions in ga

I need the following condition to be true: cond = a>b; The 3rd and 4th input arguments to ga let you specify arbitrary linear c...

20 días ago | 0

| accepted

Answered

Optimization tool: How to enable for changeable number of objective function variables?

One way is to just treat all variables as unknowns and set lb(i)=ub(i)=KnownValue(i) when you want to suppress optimization over...

Optimization tool: How to enable for changeable number of objective function variables?

One way is to just treat all variables as unknowns and set lb(i)=ub(i)=KnownValue(i) when you want to suppress optimization over...

20 días ago | 0

| accepted

Answered

Study algorithms for determining the presence of objects with specified properties on an image.

There is no command in Matlab designed specifically for that task. However, this demo may be useful, https://www.mathworks.com/...

Study algorithms for determining the presence of objects with specified properties on an image.

There is no command in Matlab designed specifically for that task. However, this demo may be useful, https://www.mathworks.com/...

20 días ago | 0

Answered

using for loop to read multiple column vectors

This should help, https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically...

using for loop to read multiple column vectors

This should help, https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically...

20 días ago | 0

Answered

Fmincon does not even try other points other than initial x0

wasn't fmincon supposed to try other values of x before getting to that final result? No, fmincon is a gradient-based solver (u...

Fmincon does not even try other points other than initial x0

wasn't fmincon supposed to try other values of x before getting to that final result? No, fmincon is a gradient-based solver (u...

21 días ago | 1

| accepted

Answered

How to assign a large multi-demensional matrix fast by index and another matrix

Indices = sub2ind([Ny,Nz,Nm,Np],Ny_list,Nz_list,Nm_list,Np_list); mtx = zeros(Nx,Ny,Nz,Nm,Np); mtx(:,Indices)=linedata(1:...

How to assign a large multi-demensional matrix fast by index and another matrix

Indices = sub2ind([Ny,Nz,Nm,Np],Ny_list,Nz_list,Nm_list,Np_list); mtx = zeros(Nx,Ny,Nz,Nm,Np); mtx(:,Indices)=linedata(1:...

22 días ago | 0

| accepted

Answered

What happens when I chenge employment

You can change your email and employment info on your Matlab account profile. If you are currently an administrator of your Matl...

What happens when I chenge employment

You can change your email and employment info on your Matlab account profile. If you are currently an administrator of your Matl...

22 días ago | 0

Answered

Minimize vector using Fmincon

You are not passing the fixed parameter variables MEdp, t, MEp, F, L, S to the objective. One way to do so is, fun=@(E) objecti...

Minimize vector using Fmincon

You are not passing the fixed parameter variables MEdp, t, MEp, F, L, S to the objective. One way to do so is, fun=@(E) objecti...

24 días ago | 0

| accepted

Answered

How to re-label a matrix based on another matrix?

If you have the Optimization Toolbox, the following is a particular efficient way based on graycomatrix(), N=max(A(:)); G=[A...

How to re-label a matrix based on another matrix?

If you have the Optimization Toolbox, the following is a particular efficient way based on graycomatrix(), N=max(A(:)); G=[A...

25 días ago | 0

| accepted

Answered

Median filter without medfilt2

Since it's a homework assignment, I don't think you need to be computationally eficient. Just loop over all the appropriately si...

Median filter without medfilt2

Since it's a homework assignment, I don't think you need to be computationally eficient. Just loop over all the appropriately si...

25 días ago | 0

Answered

How to re-label a matrix based on another matrix?

This method uses O(N^2) image comparisons, where N is the number of labels: N=max(A(:)); %number of labels L=1:N; %availab...

How to re-label a matrix based on another matrix?

This method uses O(N^2) image comparisons, where N is the number of labels: N=max(A(:)); %number of labels L=1:N; %availab...

25 días ago | 0

Answered

Optional Function input arguments

You would use varargin, https://www.mathworks.com/help/matlab/ref/varargin.html#f77-385387 function theFunction(varargin) ...

Optional Function input arguments

You would use varargin, https://www.mathworks.com/help/matlab/ref/varargin.html#f77-385387 function theFunction(varargin) ...

25 días ago | 0

| accepted

Answered

size of variables based on cell array of string names of the variable

You should have made all of your variables the fields of a structure to begin with. Then you could have simply used structfun, e...

size of variables based on cell array of string names of the variable

You should have made all of your variables the fields of a structure to begin with. Then you could have simply used structfun, e...

25 días ago | 0