回答済み

Can you compile a code including linprog function?

If you look here, linprog is not one of the Coder supported functions: https://www.mathworks.com/help/coder/ug/functions-suppor...

Can you compile a code including linprog function?

If you look here, linprog is not one of the Coder supported functions: https://www.mathworks.com/help/coder/ug/functions-suppor...

2ヶ月 前 | 0

| 採用済み

回答済み

Writing a MATLAB script for equations

E.g., put these lines in a file with a .m extension: lambda = input('Input a value for lambda: '); mtbf = 1 ./ lambda; Are yo...

Writing a MATLAB script for equations

E.g., put these lines in a file with a .m extension: lambda = input('Input a value for lambda: '); mtbf = 1 ./ lambda; Are yo...

2ヶ月 前 | 1

| 採用済み

回答済み

Lapacke in level-2 C S-function

According to the interface listed here and the link you list above: http://www.netlib.no/netlib/lapack/double/dpotrs.f The n, ...

Lapacke in level-2 C S-function

According to the interface listed here and the link you list above: http://www.netlib.no/netlib/lapack/double/dpotrs.f The n, ...

2ヶ月 前 | 0

| 採用済み

回答済み

Index Exceeds Array Bounds

Normally I would have expected to see code that sets the next values of x and y, but I don't see it. I.e., I am looking for line...

Index Exceeds Array Bounds

Normally I would have expected to see code that sets the next values of x and y, but I don't see it. I.e., I am looking for line...

2ヶ月 前 | 0

| 採用済み

回答済み

Finding remaining numbers in logical indexing?

E.g., find1 = length<1; : find2 = (length < 3) & (max_width_head > mean_width_neck*2); : find3 = max_width_head>=me...

Finding remaining numbers in logical indexing?

E.g., find1 = length<1; : find2 = (length < 3) & (max_width_head > mean_width_neck*2); : find3 = max_width_head>=me...

2ヶ月 前 | 0

| 採用済み

回答済み

How to use mxCreateNumericArray

This line is incorrect (wrong function and signature): plhs[0] = mxCreateNumericArray(xynum,1,mxINT16_CLASS); /*Creates a ma...

How to use mxCreateNumericArray

This line is incorrect (wrong function and signature): plhs[0] = mxCreateNumericArray(xynum,1,mxINT16_CLASS); /*Creates a ma...

2ヶ月 前 | 0

| 採用済み

回答済み

Why is my if statement breaking when condition is not met?

The == operator is an element-wise operator. You need to use a string comparison function for this. E.g., if( strcmpi(verbose...

Why is my if statement breaking when condition is not met?

The == operator is an element-wise operator. You need to use a string comparison function for this. E.g., if( strcmpi(verbose...

2ヶ月 前 | 0

| 採用済み

回答済み

Multidimensional arrays do not work in mex functions?

You can't use multi-level [ ][ ]... syntax with simple pointers. E.g., look at these lines: void matsum(double *dphidt, double ...

Multidimensional arrays do not work in mex functions?

You can't use multi-level [ ][ ]... syntax with simple pointers. E.g., look at these lines: void matsum(double *dphidt, double ...

2ヶ月 前 | 0

回答済み

An efficient (quick) way of entering complex data into Matlab workspace.

Assuming you are using R2018a or later, you might try this FEX submission which can reinterpret real variables as interleaved co...

An efficient (quick) way of entering complex data into Matlab workspace.

Assuming you are using R2018a or later, you might try this FEX submission which can reinterpret real variables as interleaved co...

2ヶ月 前 | 0

| 採用済み

回答済み

How to get direction for 3d angles between 2 vectors

You will need to define in your code which direction is the clockwise and which is counterclockwise. You can do that by definin...

How to get direction for 3d angles between 2 vectors

You will need to define in your code which direction is the clockwise and which is counterclockwise. You can do that by definin...

2ヶ月 前 | 1

| 採用済み

回答済み

How to code this problem?

E.g., syms x A = [1 2 4 5]; n = numel(A); P = prod(x-A); X = cell(n,1); for k=1:n X{k} = P / (x-A(k)); end This giv...

How to code this problem?

E.g., syms x A = [1 2 4 5]; n = numel(A); P = prod(x-A); X = cell(n,1); for k=1:n X{k} = P / (x-A(k)); end This giv...

2ヶ月 前 | 0

回答済み

ODE45 generates undesired matrix of NaN entries

This is often an initial condition issue with the specific DE's involved. In your code, you have icond(2) = 0 icond(3) = ((F/...

ODE45 generates undesired matrix of NaN entries

This is often an initial condition issue with the specific DE's involved. In your code, you have icond(2) = 0 icond(3) = ((F/...

2ヶ月 前 | 0

回答済み

How can I transfer the size of the array to mexFunction

Try this (caveat, untested). Don't pass in the row size of the matrix ... just pass in the matrix only. Let the code figure ou...

How can I transfer the size of the array to mexFunction

Try this (caveat, untested). Don't pass in the row size of the matrix ... just pass in the matrix only. Let the code figure ou...

2ヶ月 前 | 0

| 採用済み

回答済み

Preallocating a Matrix(For loop, Vectorization)?

In these lines: Y4=repmat(A,N,1); Y4 = cell2mat(arrayfun(@(i) A^i, (1:N)', 'Uni', false) The first line assigns something to ...

Preallocating a Matrix(For loop, Vectorization)?

In these lines: Y4=repmat(A,N,1); Y4 = cell2mat(arrayfun(@(i) A^i, (1:N)', 'Uni', false) The first line assigns something to ...

2ヶ月 前 | 1

| 採用済み

回答済み

how can i use several loops

MATLAB will do all of the loops in the order it encounters them. So for the k=1 iteration it will do the i=1:nx loop in its enti...

how can i use several loops

MATLAB will do all of the loops in the order it encounters them. So for the k=1 iteration it will do the i=1:nx loop in its enti...

2ヶ月 前 | 0

| 採用済み

回答済み

Call function and save results

Maybe just display the results: disp(results); Or loop differently: for k = 1:size(results,1) disp(results(k,:)) end

Call function and save results

Maybe just display the results: disp(results); Or loop differently: for k = 1:size(results,1) disp(results(k,:)) end

2ヶ月 前 | 0

| 採用済み

回答済み

How do i do Matrix reordering (cutting into blocks)?

It's not exactly clear what the actual size of your matrix is (maybe you could clarify), but for what you have posted maybe this...

How do i do Matrix reordering (cutting into blocks)?

It's not exactly clear what the actual size of your matrix is (maybe you could clarify), but for what you have posted maybe this...

2ヶ月 前 | 0

| 採用済み

回答済み

Can i delete part of a cell array based on a condition?

E.g., >> C = {'CGU','UUU','UAG','GGU'} C = 1×4 cell array {'CGU'} {'UUU'} {'UAG'} {'GGU'} >> X = {'UAA','UAG...

Can i delete part of a cell array based on a condition?

E.g., >> C = {'CGU','UUU','UAG','GGU'} C = 1×4 cell array {'CGU'} {'UUU'} {'UAG'} {'GGU'} >> X = {'UAA','UAG...

2ヶ月 前 | 0

| 採用済み

回答済み

Why am I receiving this error "Index in position 2 exceeds array bounds (must not exceed 1)."

When you load into a variable, the data loads into a struct. The fieldnames of that struct are the variables in the mat file. S...

Why am I receiving this error "Index in position 2 exceeds array bounds (must not exceed 1)."

When you load into a variable, the data loads into a struct. The fieldnames of that struct are the variables in the mat file. S...

2ヶ月 前 | 1

回答済み

Index error when using function

We need to see more of your code to be sure, but you likely have a variable named either f or dx that is shadowing a function of...

Index error when using function

We need to see more of your code to be sure, but you likely have a variable named either f or dx that is shadowing a function of...

2ヶ月 前 | 0

回答済み

No-copy read object property from mex c++

There is no official API method to do this with the C API. You have to resort to unofficial hacks. E.g., see this FEX submission...

No-copy read object property from mex c++

There is no official API method to do this with the C API. You have to resort to unofficial hacks. E.g., see this FEX submission...

2ヶ月 前 | 0

回答済み

How to make an array that the elements are matrix

Maybe use a cell array? E.g., graph.frontier = {[3x3],[3x3],[3x3],[3x3]}; You can then get at the matrices with curly braces,...

How to make an array that the elements are matrix

Maybe use a cell array? E.g., graph.frontier = {[3x3],[3x3],[3x3],[3x3]}; You can then get at the matrices with curly braces,...

2ヶ月 前 | 0

回答済み

Fastest way to find number of times a number occurs in an array?

So, you've got some potential speed problems with your posted methods. When you evaluate the expression X(:,2) repeatedly tha...

Fastest way to find number of times a number occurs in an array?

So, you've got some potential speed problems with your posted methods. When you evaluate the expression X(:,2) repeatedly tha...

3ヶ月 前 | 1

| 採用済み

回答済み

Second oder ode solution with euler methods

Rewrite your 2nd order equation as a pair of first order equations, then use Euler method on a 2-element vector. I.e., Define y...

Second oder ode solution with euler methods

Rewrite your 2nd order equation as a pair of first order equations, then use Euler method on a 2-element vector. I.e., Define y...

3ヶ月 前 | 0

回答済み

automating global definition inside multiple functions

Ugh! This is not a good code design. There are better choices. E.g., maybe use a struct with fields named for your variables, a...

automating global definition inside multiple functions

Ugh! This is not a good code design. There are better choices. E.g., maybe use a struct with fields named for your variables, a...

3ヶ月 前 | 0

回答済み

Calculating axial stresses of different beams

E.g., maybe using the element-wise division operator is all you need: axialforce = a scalar or vector of axial forces area = a...

Calculating axial stresses of different beams

E.g., maybe using the element-wise division operator is all you need: axialforce = a scalar or vector of axial forces area = a...

3ヶ月 前 | 0

| 採用済み

回答済み

how to replace elements in top third, middle third, and bottom third of matix

Your row indexing is wrong. The first n rows are 1:n which you have correct. The second n rows indexing is n more that the fir...

how to replace elements in top third, middle third, and bottom third of matix

Your row indexing is wrong. The first n rows are 1:n which you have correct. The second n rows indexing is n more that the fir...

3ヶ月 前 | 1

| 採用済み

回答済み

How to put 2 matrices together to make one matrix?

To stack them vertically, A = your 7x2 matrix B = your 3x2 matrix result = [A;B]; If you had two matrices that you wanted to...

How to put 2 matrices together to make one matrix?

To stack them vertically, A = your 7x2 matrix B = your 3x2 matrix result = [A;B]; If you had two matrices that you wanted to...

3ヶ月 前 | 0

回答済み

Two Dice Monte Carlo Simulation

You don't have your for-loops set up properly. You are trying to find the probability that five consecutive 7's occur in 100 ro...

Two Dice Monte Carlo Simulation

You don't have your for-loops set up properly. You are trying to find the probability that five consecutive 7's occur in 100 ro...

3ヶ月 前 | 0

| 採用済み