Answered

Publishing an mfile including the calls to other m files.

Does this help: https://www.mathworks.com/matlabcentral/fileexchange/33476-publish-dependent-and-called-functions ?

Publishing an mfile including the calls to other m files.

Does this help: https://www.mathworks.com/matlabcentral/fileexchange/33476-publish-dependent-and-called-functions ?

11 dagen ago | 0

Answered

I can`t solwe gauss elimination method

I've simplified the code and converted it from Octave to Matlab: A = [ -3 6 -1 -2; -3 3 -3 1; -1.5 4.5 -2.5 -0.5; 0 1.5 -0.5 -3...

I can`t solwe gauss elimination method

I've simplified the code and converted it from Octave to Matlab: A = [ -3 6 -1 -2; -3 3 -3 1; -1.5 4.5 -2.5 -0.5; 0 1.5 -0.5 -3...

11 dagen ago | 0

| accepted

Answered

Arrays have incompatible sizes for this operation.

Use the debugger to identify the problem. Type this in the command window: dbstop if error and run the code again. When Matlab...

Arrays have incompatible sizes for this operation.

Use the debugger to identify the problem. Type this in the command window: dbstop if error and run the code again. When Matlab...

11 dagen ago | 0

| accepted

Answered

How its possible do define this function in Matlab?

Your funcion is almost correct. Just change && to & and consider the logical index time in the output. The problem in your case...

How its possible do define this function in Matlab?

Your funcion is almost correct. Just change && to & and consider the logical index time in the output. The problem in your case...

11 dagen ago | 1

| accepted

Answered

Automatically Run Script at End of Toolbox Installation

I include a function, which runs once the first time the toolbox is called instead. This is "after the installation", but not di...

Automatically Run Script at End of Toolbox Installation

I include a function, which runs once the first time the toolbox is called instead. This is "after the installation", but not di...

14 dagen ago | 1

| accepted

Answered

when i was plotting i reveived this error, please help me out....

For me it works: fun = @(x) exp(-x) - 3.*x.^2 + 26 fplot(fun,[0 5]) grid on So if this fails for you, you are running anothe...

when i was plotting i reveived this error, please help me out....

For me it works: fun = @(x) exp(-x) - 3.*x.^2 + 26 fplot(fun,[0 5]) grid on So if this fails for you, you are running anothe...

14 dagen ago | 1

Answered

How can I vectorize the nested loops in my code to improve performance?

The editor shows you 12 valuable hints already: Letting an array grow iteratively is very expensive. See this example: x = []; ...

How can I vectorize the nested loops in my code to improve performance?

The editor shows you 12 valuable hints already: Letting an array grow iteratively is very expensive. See this example: x = []; ...

15 dagen ago | 2

| accepted

Answered

how to solve this MATLAB solve error?

This looks suspicious: "datatype = integer[1]" ?! Maybe there is some preceeding code, which causes problems? At least the show...

how to solve this MATLAB solve error?

This looks suspicious: "datatype = integer[1]" ?! Maybe there is some preceeding code, which causes problems? At least the show...

15 dagen ago | 0

| accepted

Answered

How to get an array of all field elements of a 1xN structure with many fields

Fields = fieldnames(S); for ii= 1:numel(Fields); field = Fields{ii}; [S(:).(field)] end [...] is the horizontal con...

How to get an array of all field elements of a 1xN structure with many fields

Fields = fieldnames(S); for ii= 1:numel(Fields); field = Fields{ii}; [S(:).(field)] end [...] is the horizontal con...

15 dagen ago | 1

Answered

Time-varying coefficient in ODE.

Which ODE solver do you use? Remember that Matlab's builtin ODE solvers like ODE45 ar designed for smooth functions only. A para...

Time-varying coefficient in ODE.

Which ODE solver do you use? Remember that Matlab's builtin ODE solvers like ODE45 ar designed for smooth functions only. A para...

15 dagen ago | 0

Answered

Extracting data from a figure

The error message looks like you are opening a .fig file but you do not have the required SizeChangeFcn. Then you can redefine t...

Extracting data from a figure

The error message looks like you are opening a .fig file but you do not have the required SizeChangeFcn. Then you can redefine t...

16 dagen ago | 0

Answered

Error using fzero (line 184) FUN must be a function, a valid character vector expression, or an inline function object. What is the issue here?

v is the variable of the function. You do not have to deine it as a vector. fzero expects a function handle, but f(vi) is a num...

Error using fzero (line 184) FUN must be a function, a valid character vector expression, or an inline function object. What is the issue here?

v is the variable of the function. You do not have to deine it as a vector. fzero expects a function handle, but f(vi) is a num...

16 dagen ago | 0

Answered

A Matlab Code is "Attempt to execute SCRIPT ballTrajectoryFun as a function:"

The file ballTrajectoryFun.m is a script, not a function. Functions start with the keyword "function". If they are called from O...

A Matlab Code is "Attempt to execute SCRIPT ballTrajectoryFun as a function:"

The file ballTrajectoryFun.m is a script, not a function. Functions start with the keyword "function". If they are called from O...

16 dagen ago | 1

Answered

How do i add a for loop if command to a pre existing table

shop1 = [4,5,3,6,0,5,5,6,4,5]; shop2 = [5,3,1,1,3,5,3,6,3,3]; profit1 = 3 * shop1; profit2 = 4 * shop2; pool = {'Sh...

How do i add a for loop if command to a pre existing table

shop1 = [4,5,3,6,0,5,5,6,4,5]; shop2 = [5,3,1,1,3,5,3,6,3,3]; profit1 = 3 * shop1; profit2 = 4 * shop2; pool = {'Sh...

16 dagen ago | 0

| accepted

Answered

divide a vector into two vectors of unequal length

A = [1 2 3 4 5 6]; idx = ceil(numel(A) * 2 / 3); B = A(1:idx) C = A(idx + 1:end)

divide a vector into two vectors of unequal length

A = [1 2 3 4 5 6]; idx = ceil(numel(A) * 2 / 3); B = A(1:idx) C = A(idx + 1:end)

16 dagen ago | 2

| accepted

Answered

Error: array indices must be positive integers

You can use the debugger to find the cause of the problem. Let Matlab stop when the error occurs: dbstop if error Type this in...

Error: array indices must be positive integers

You can use the debugger to find the cause of the problem. Let Matlab stop when the error occurs: dbstop if error Type this in...

17 dagen ago | 0

| accepted

Answered

I need to make a function that solves the first derivative of a function using forward finite difference. I've tried creating the function but I encountered an error.

You provide the CHAR vector 'q3func' as input, but you want a handle to the function instead: fd = forwarddiff(@q3func, -2:2, 0...

I need to make a function that solves the first derivative of a function using forward finite difference. I've tried creating the function but I encountered an error.

You provide the CHAR vector 'q3func' as input, but you want a handle to the function instead: fd = forwarddiff(@q3func, -2:2, 0...

17 dagen ago | 0

| accepted

Answered

How to increase the performance of a cycle for in its use in large matrices?

Why do you calculate the mean of the complete BMEDIA matrix, if you use the output for the element (i,j) only? A = zeros(size(d...

How to increase the performance of a cycle for in its use in large matrices?

Why do you calculate the mean of the complete BMEDIA matrix, if you use the output for the element (i,j) only? A = zeros(size(d...

17 dagen ago | 1

| accepted

Answered

Help with Matlab function

This homework question contains useful instructions already: "Compute n+1 equidistant points xk , k=0,...,n, between a and b" ...

Help with Matlab function

This homework question contains useful instructions already: "Compute n+1 equidistant points xk , k=0,...,n, between a and b" ...

18 dagen ago | 0

| accepted

Answered

Facing problems while compiling several large Mex files

The problem is not the compiler, but hidden in the function mex_compiling in the line 9. It looks like tis function expects the ...

Facing problems while compiling several large Mex files

The problem is not the compiler, but hidden in the function mex_compiling in the line 9. It looks like tis function expects the ...

18 dagen ago | 0

Answered

how to store a double loop result into a matrix column by column?

You are using one counter k for the up and the down lists. cycle1 = [butterworth_filter1,butterworth_filter2]; [m, n] = size(c...

how to store a double loop result into a matrix column by column?

You are using one counter k for the up and the down lists. cycle1 = [butterworth_filter1,butterworth_filter2]; [m, n] = size(c...

18 dagen ago | 0

Answered

How to name Array with each of my Arrays in a bulk folder?

Do not hide an index in the name of variables. Although it is piossible to do this using the eval command, it increases the comp...

How to name Array with each of my Arrays in a bulk folder?

Do not hide an index in the name of variables. Although it is piossible to do this using the eval command, it increases the comp...

19 dagen ago | 1

Answered

Is there a way to retrieve MATLAB busy status from a C# application

The direct solution is to let the Matlab script trigger this: function SetBusyFlag(ScriptName) FlagFile = fullfile(tempdir, 'M...

Is there a way to retrieve MATLAB busy status from a C# application

The direct solution is to let the Matlab script trigger this: function SetBusyFlag(ScriptName) FlagFile = fullfile(tempdir, 'M...

19 dagen ago | 0

Answered

Runge-Kutta 4th Order

Start with Matlab's onramp: https://www.mathworks.com/learn/tutorials/matlab-onramp.html This is not a tutorial for an RK4 sol...

Runge-Kutta 4th Order

Start with Matlab's onramp: https://www.mathworks.com/learn/tutorials/matlab-onramp.html This is not a tutorial for an RK4 sol...

21 dagen ago | 0

Answered

Trying to pass a variable name for a file in a for loop to xlsread

pathname = 'C:\Documents\MATLAB\FileName.xlsx'; This is a fixed CHAR vector and does not consider the variable FileName. Steph...

Trying to pass a variable name for a file in a for loop to xlsread

pathname = 'C:\Documents\MATLAB\FileName.xlsx'; This is a fixed CHAR vector and does not consider the variable FileName. Steph...

21 dagen ago | 0

| accepted

Answered

Unique value for each sequence of two corresponding variables

A = [ 1 1 1 2 2 1 1 1 3 3 2 2 2 3 3 3]; B = [ 7 7 7 9 9 7 7 7 7 7 9 9 9 7 7 7]; [Aa, iA] = unique(A, 'first'); Bb = B(iA); ...

Unique value for each sequence of two corresponding variables

A = [ 1 1 1 2 2 1 1 1 3 3 2 2 2 3 3 3]; B = [ 7 7 7 9 9 7 7 7 7 7 9 9 9 7 7 7]; [Aa, iA] = unique(A, 'first'); Bb = B(iA); ...

21 dagen ago | 0

| accepted

Answered

Built-in "filter" function works drastically faster in Matlab than in generated C code

That filter becomes the bottleneck can have two reasons: filter is processed less efficiently in the generated C code. The eff...

Built-in "filter" function works drastically faster in Matlab than in generated C code

That filter becomes the bottleneck can have two reasons: filter is processed less efficiently in the generated C code. The eff...

23 dagen ago | 0

Answered

MATLAB Hardware Key Licensing

You can install and activate Matlab on an offline machine without any net connection from this computer. You need another comput...

MATLAB Hardware Key Licensing

You can install and activate Matlab on an offline machine without any net connection from this computer. You need another comput...

24 dagen ago | 0

Answered

mex error for path names with spaces

Try this: mex('<my script>', '-I"C:\Program Files\MySQL\MySQL Server 8.0\include\"', ... '-L"C:\Program Files\MySQL\MySQL ...

mex error for path names with spaces

Try this: mex('<my script>', '-I"C:\Program Files\MySQL\MySQL Server 8.0\include\"', ... '-L"C:\Program Files\MySQL\MySQL ...

24 dagen ago | 3