Interested in external applications, mex & engine applications with Fortran, C, C++, etc, particularly in the areas of speed improvement and memory management efficiencies.

Answered

How to limit calculation precision?

You can get about that precision (a little less) by using the half data type: https://www.mathworks.com/help/fixedpoint/ref/hal...

How to limit calculation precision?

You can get about that precision (a little less) by using the half data type: https://www.mathworks.com/help/fixedpoint/ref/hal...

3 dagar ago | 1

Answered

FOR LOOP NOT WORKING

Index your answers. E.g., if EXANGLES(i) < 90 EVANGLE1(i) = EVSUB1-FT126; elseif EXANGLES(i) == 90 ...

FOR LOOP NOT WORKING

Index your answers. E.g., if EXANGLES(i) < 90 EVANGLE1(i) = EVSUB1-FT126; elseif EXANGLES(i) == 90 ...

4 dagar ago | 0

Answered

Numerical Solution of the System of four Coupled Nonlinear ODEs by Runge-Kutta Fourth Order Method

I will point out some problems, and then suggest a much easier way to do this. Start with your first couple of lines in the loo...

Numerical Solution of the System of four Coupled Nonlinear ODEs by Runge-Kutta Fourth Order Method

I will point out some problems, and then suggest a much easier way to do this. Start with your first couple of lines in the loo...

4 dagar ago | 0

Answered

can i get mex files in matlab format?

Mex files are compiled (i.e., machine language) DLL files. You cannot view them in MATLAB m-file format. If you have the C/C++...

can i get mex files in matlab format?

Mex files are compiled (i.e., machine language) DLL files. You cannot view them in MATLAB m-file format. If you have the C/C++...

4 dagar ago | 0

| accepted

Answered

I need help obtaining the values c1,c2.c3 from a least squares fit of the data.

It appears to me that your equation is linear in c1, c2, c3. Just make a matrix equation out of this and then apply your least ...

I need help obtaining the values c1,c2.c3 from a least squares fit of the data.

It appears to me that your equation is linear in c1, c2, c3. Just make a matrix equation out of this and then apply your least ...

5 dagar ago | 0

Answered

How to add an NxN matrix with K pages ?

You are correct, sum(A,3) is the correct syntax to use. This sums across the 3rd dimension.

How to add an NxN matrix with K pages ?

You are correct, sum(A,3) is the correct syntax to use. This sums across the 3rd dimension.

10 dagar ago | 0

Answered

How do I vectorize matrices of specific modes of a tensor?

Is this what you want? x = your 250 x 250 x 183 array result = reshape(x,250*250,183);

How do I vectorize matrices of specific modes of a tensor?

Is this what you want? x = your 250 x 250 x 183 array result = reshape(x,250*250,183);

12 dagar ago | 0

Answered

Why the memory Limitation to a data structure in cpp: size of "XXX::C_SubNetwork::S_ListBuffer [3]" >= 256 Mb and can I raise the limit higher?

This looks like you are declaring this variable as a local variable, in which case the memory for it will come off of the stack....

Why the memory Limitation to a data structure in cpp: size of "XXX::C_SubNetwork::S_ListBuffer [3]" >= 256 Mb and can I raise the limit higher?

This looks like you are declaring this variable as a local variable, in which case the memory for it will come off of the stack....

13 dagar ago | 0

Answered

mxCreateNumericMatrix and sparse matrix in C/Matlab hybrid programming

Convert the index arrays to double either inside the C code or on the Engine side. E.g., engEvalString(ep, "MS=sparse(double(MI...

mxCreateNumericMatrix and sparse matrix in C/Matlab hybrid programming

Convert the index arrays to double either inside the C code or on the Engine side. E.g., engEvalString(ep, "MS=sparse(double(MI...

16 dagar ago | 0

Answered

Converting double values file to 2 byte per sample.

If you want a two byte floating point representation you can use half precision. E.g., https://www.mathworks.com/matlabcentral/...

Converting double values file to 2 byte per sample.

If you want a two byte floating point representation you can use half precision. E.g., https://www.mathworks.com/matlabcentral/...

18 dagar ago | 0

Answered

How can I multiply N dimensional matrices

Other options from the FEX: https://www.mathworks.com/matlabcentral/fileexchange/8773-multiple-matrix-multiplications-with-arra...

How can I multiply N dimensional matrices

Other options from the FEX: https://www.mathworks.com/matlabcentral/fileexchange/8773-multiple-matrix-multiplications-with-arra...

18 dagar ago | 1

Answered

whats difference beetween angvel and rotvec?

I don't have a version of MATLAB installed that has the angvel( ) and rotvec( ) functions, so I can only make an educated guess....

whats difference beetween angvel and rotvec?

I don't have a version of MATLAB installed that has the angvel( ) and rotvec( ) functions, so I can only make an educated guess....

19 dagar ago | 0

Answered

Strncpy/Strncpy_s is supported by Matlab

Your code has bugs. That is why it is crashing. The bugs are caused by these lines: main(); // You call main without any ...

Strncpy/Strncpy_s is supported by Matlab

Your code has bugs. That is why it is crashing. The bugs are caused by these lines: main(); // You call main without any ...

19 dagar ago | 0

Answered

Fast conversion of 2 matrices to 1 complex matrix

See this FEX submission for reading and writing interleaved complex data in R2018a or later without extra data copies: https://...

Fast conversion of 2 matrices to 1 complex matrix

See this FEX submission for reading and writing interleaved complex data in R2018a or later without extra data copies: https://...

26 dagar ago | 0

Answered

How to replace leading zeroes by spaces with regexprep

One way: fun = @(x)sprintf(['%' num2str(numel(x)) 'd'],str2double(x)); d = cellfun(fun,a,'uni',false); e = cellfun(fun,b,'uni...

How to replace leading zeroes by spaces with regexprep

One way: fun = @(x)sprintf(['%' num2str(numel(x)) 'd'],str2double(x)); d = cellfun(fun,a,'uni',false); e = cellfun(fun,b,'uni...

26 dagar ago | 0

Answered

trimming matrix arrays arranged within cell arrays

It is not clear whether you want the rows or columns trimmed. Maybe one of these is what you want? TrimmedArray = cellfun(@(x) ...

trimming matrix arrays arranged within cell arrays

It is not clear whether you want the rows or columns trimmed. Maybe one of these is what you want? TrimmedArray = cellfun(@(x) ...

26 dagar ago | 0

Answered

Runge-Kutta 4th order function error (Matrix dimensions must agree)

Your RK_4 function is not set up to handle vector equations ... it is only set up to handle scalar equations. Also you are not ...

Runge-Kutta 4th order function error (Matrix dimensions must agree)

Your RK_4 function is not set up to handle vector equations ... it is only set up to handle scalar equations. Also you are not ...

26 dagar ago | 0

Answered

How to pass arguments by reference from Matlab?

doc loadlibrary Create a C header file that gives prototypes for the Fortran subroutines and treat the Fortran arguments as poi...

How to pass arguments by reference from Matlab?

doc loadlibrary Create a C header file that gives prototypes for the Fortran subroutines and treat the Fortran arguments as poi...

ungefär en månad ago | 0

Answered

how to create an array of all permutations

If you want all of them in an array (which might be too large if the number of digits is too large), you can use n = number of ...

how to create an array of all permutations

If you want all of them in an array (which might be too large if the number of digits is too large), you can use n = number of ...

ungefär en månad ago | 0

| accepted

Answered

Trying to do calculations for density

Why do you have these lines in your function: P_t=4; P_s=3; H=25; Aren't these variable supposed to be input arguments? See...

Trying to do calculations for density

Why do you have these lines in your function: P_t=4; P_s=3; H=25; Aren't these variable supposed to be input arguments? See...

ungefär en månad ago | 0

| accepted

Submitted

freadcomplex and fwritecomplex

Mex routines that read and write interleaved complex data files for MATLAB R2018a or later without extra data copy.

ungefär en månad ago | 3 downloads |

Answered

efficient ways to read and write complex valued data

A mex routine to accomplish this that doesn't use any hacks can be found here: https://www.mathworks.com/matlabcentral/fileexch...

efficient ways to read and write complex valued data

A mex routine to accomplish this that doesn't use any hacks can be found here: https://www.mathworks.com/matlabcentral/fileexch...

ungefär en månad ago | 0

| accepted

Answered

efficient ways to read and write complex valued data

This may not apply to you, but if you have R2018a or later you can just fread( ) into a real variable directly the interleaved d...

efficient ways to read and write complex valued data

This may not apply to you, but if you have R2018a or later you can just fread( ) into a real variable directly the interleaved d...

ungefär en månad ago | 0

Answered

Changing contents of Cell Array mex files

When you mxDestroyArray a cell array or struct array, it does a deep destroy. Meaning all of the cell array or struct array ele...

Changing contents of Cell Array mex files

When you mxDestroyArray a cell array or struct array, it does a deep destroy. Meaning all of the cell array or struct array ele...

ungefär en månad ago | 0

| accepted

Answered

solution with the Runge-Kutta method HELPP

This is clearly a homework/exam question, so I will only offer hints. The code you have posted is for a single scalar different...

solution with the Runge-Kutta method HELPP

This is clearly a homework/exam question, so I will only offer hints. The code you have posted is for a single scalar different...

ungefär en månad ago | 0

Answered

How could I use MATLAB to solve for x with this equation, 0=a*x^(3)+b*x^(-1)+c.

Just use the roots( ) function. If you have a negative integer power of x in the expression such as x^(-n), then multiply every...

How could I use MATLAB to solve for x with this equation, 0=a*x^(3)+b*x^(-1)+c.

Just use the roots( ) function. If you have a negative integer power of x in the expression such as x^(-n), then multiply every...

ungefär en månad ago | 0

Answered

reshape loop resulted cell array

result = cell2mat(c1(:))';

reshape loop resulted cell array

result = cell2mat(c1(:))';

ungefär 2 månader ago | 0

| accepted

Answered

Matrix with nested for loops

You don't need loops for this. E.g., p = the probability result = rand(20,20) < p; % your matrix of 0's and 1's

Matrix with nested for loops

You don't need loops for this. E.g., p = the probability result = rand(20,20) < p; % your matrix of 0's and 1's

ungefär 2 månader ago | 0

| accepted

Answered

Bit xor of two binary strings and conversion into decimal

The xor part as a logical vector result result = str1 ~= str2; Or if you wanted it as char: str3 = char((str1 ~= str2) + '0')...

Bit xor of two binary strings and conversion into decimal

The xor part as a logical vector result result = str1 ~= str2; Or if you wanted it as char: str3 = char((str1 ~= str2) + '0')...

ungefär 2 månader ago | 0

| accepted

Answered

Function 'quatrotate' not supported for code generation.

You can always write your own. Just code up the matrix multiply at the bottom of the doc page: https://www.mathworks.com/help/...

Function 'quatrotate' not supported for code generation.

You can always write your own. Just code up the matrix multiply at the bottom of the doc page: https://www.mathworks.com/help/...

ungefär 2 månader ago | 1