3,017 total contributions since 2007

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

Answered

Error using mex: undefined reference for user build package

Try looking in the MATLAB/R2019a/extern/lib folder for versions of these files appropriate for your system. They might have slig...

Error using mex: undefined reference for user build package

Try looking in the MATLAB/R2019a/extern/lib folder for versions of these files appropriate for your system. They might have slig...

2 days ago | 0

Answered

Problem with MexFunction and MexGetPr

Impossible to answer without seeing the code for the functionsum( ) function. Maybe you could post that? Maybe all you need to...

Problem with MexFunction and MexGetPr

Impossible to answer without seeing the code for the functionsum( ) function. Maybe you could post that? Maybe all you need to...

3 days ago | 0

| accepted

Answered

Unexpected numerical error in built-in cross product

When I calculate things from scratch, everything works to the expected precision. E.g., run this code: % From post rTAN = [6.2...

Unexpected numerical error in built-in cross product

When I calculate things from scratch, everything works to the expected precision. E.g., run this code: % From post rTAN = [6.2...

20 days ago | 2

Answered

MEX crashes when called twice in succession (Same input)

Here is one cause of a crash: mwIndex *subs; subs[0]=1; subs[1]=1; You are dereferencing an uninitialized pointer on that se...

MEX crashes when called twice in succession (Same input)

Here is one cause of a crash: mwIndex *subs; subs[0]=1; subs[1]=1; You are dereferencing an uninitialized pointer on that se...

20 days ago | 0

Answered

Change sign of descending values

Is this what you want? x = your vector of values d = [1;diff(x)]; x(d<0) = -x(d<0);

Change sign of descending values

Is this what you want? x = your vector of values d = [1;diff(x)]; x(d<0) = -x(d<0);

21 days ago | 1

| accepted

Answered

how to iterate a matrix for multiple times

E.g., here is a possible outline n = 30; % the number of iterations M = rand(5,5); % some initial matrix for k=1:n M = 2...

how to iterate a matrix for multiple times

E.g., here is a possible outline n = 30; % the number of iterations M = rand(5,5); % some initial matrix for k=1:n M = 2...

21 days ago | 1

| accepted

Answered

Using the dms2degree Command Sequentially to Populate an Array using a Sub-routine

With a for-loop, you need to use A in all of your indexing and use the [ ] brackets to form a vector input (and spell the functi...

Using the dms2degree Command Sequentially to Populate an Array using a Sub-routine

With a for-loop, you need to use A in all of your indexing and use the [ ] brackets to form a vector input (and spell the functi...

21 days ago | 0

Answered

Write a function called valid_date that takes three positive integer scalar inputs year, month, day. If these three represent a valid date, return a logical true, otherwise false. The name of the output argument is valid.

Looks like you are taking the same class as Rahul. Rather than repeat my answer here, I will simply direct you to the link: ht...

Write a function called valid_date that takes three positive integer scalar inputs year, month, day. If these three represent a valid date, return a logical true, otherwise false. The name of the output argument is valid.

Looks like you are taking the same class as Rahul. Rather than repeat my answer here, I will simply direct you to the link: ht...

21 days ago | 0

| accepted

Answered

I need some help in seeing where I am going wrong and how to proceed with writing a particular funciton for a MATLAB course I am taking please.

Some issues: n is a fixed input ... you should not be changing n inside your function. Get rid of that n = n + 1 statement. T...

I need some help in seeing where I am going wrong and how to proceed with writing a particular funciton for a MATLAB course I am taking please.

Some issues: n is a fixed input ... you should not be changing n inside your function. Get rid of that n = n + 1 statement. T...

22 days ago | 1

| accepted

Answered

Use of int vs size_t in mex compilation of C-function dgemm.

If you are linking to the MATLAB supplied BLAS/LAPACK libraries, then all of the integer types being used for arguments to these...

Use of int vs size_t in mex compilation of C-function dgemm.

If you are linking to the MATLAB supplied BLAS/LAPACK libraries, then all of the integer types being used for arguments to these...

23 days ago | 0

| accepted

Answered

For loop to extract every 3rd column out of matrix and assign as variable name

Do not do this! This will only lead to headaches downstream in your code for processing these variables (you will need to use m...

For loop to extract every 3rd column out of matrix and assign as variable name

Do not do this! This will only lead to headaches downstream in your code for processing these variables (you will need to use m...

24 days ago | 1

| accepted

Answered

random generator on level of bytes

Generate random integers and then multiply them by 8 to guarantee that the result is divisible by 8. E.g., something like: max_...

random generator on level of bytes

Generate random integers and then multiply them by 8 to guarantee that the result is divisible by 8. E.g., something like: max_...

28 days ago | 2

Answered

Calculate sum of series using for

Here is an outline to get you started: a = something; % you put a value here m = something; % you put a value here x = someth...

Calculate sum of series using for

Here is an outline to get you started: a = something; % you put a value here m = something; % you put a value here x = someth...

28 days ago | 1

| accepted

Answered

Decimal to Binary Conversion

E.g., bstream = reshape(b',1,[]); If you want characters, then bstream = char(reshape(b',1,[]) + '0');

Decimal to Binary Conversion

E.g., bstream = reshape(b',1,[]); If you want characters, then bstream = char(reshape(b',1,[]) + '0');

28 days ago | 1

| accepted

Answered

How to output a vector/array from a created function

Don't use size(inputVector) for your loop indexing limits since this is a vector. Use numel(inputVector) instead. Also, you sho...

How to output a vector/array from a created function

Don't use size(inputVector) for your loop indexing limits since this is a vector. Use numel(inputVector) instead. Also, you sho...

29 days ago | 0

Answered

Cpp to Mex conversion

Looks like you have a mismatch with variable types, probably an older piece of code that you are trying to compile on a newer MA...

Cpp to Mex conversion

Looks like you have a mismatch with variable types, probably an older piece of code that you are trying to compile on a newer MA...

30 days ago | 1

| accepted

Submitted

mxGetPropertyPtr & mxSetPropertySDC C-mex functions

Fast memory efficient alternative to API functions mxGetProperty & mxSetProperty.

1 month ago | 1 download |

Answered

how to solve 'Error using | Matrix dimensions must agree. ' ?

Maybe this line: while (Lia2_One_Three ~= zeros(length(Lia2_One_Three),1) | Lia2_Two_Three ~= zeros(length(Lia2_Two_Three),1)...

how to solve 'Error using | Matrix dimensions must agree. ' ?

Maybe this line: while (Lia2_One_Three ~= zeros(length(Lia2_One_Three),1) | Lia2_Two_Three ~= zeros(length(Lia2_Two_Three),1)...

1 month ago | 0

| accepted

Answered

Print from C file into Command window via MexFile

"However I would like to print directly from the c-file to Matlab Command Window. Is that possible?" Yes, that is what mexPrint...

Print from C file into Command window via MexFile

"However I would like to print directly from the c-file to Matlab Command Window. Is that possible?" Yes, that is what mexPrint...

1 month ago | 1

| accepted

Answered

could anyone help me to solve the issue with respect to the code

The syntax of a for-loop is: for k=1:5 % your code here end

could anyone help me to solve the issue with respect to the code

The syntax of a for-loop is: for k=1:5 % your code here end

1 month ago | 0

Answered

How can I see the filter function implementation code at MATLAB?

In general, if the function has an associated .m file then TMW is willing to show you that much. Also there may be information ...

How can I see the filter function implementation code at MATLAB?

In general, if the function has an associated .m file then TMW is willing to show you that much. Also there may be information ...

1 month ago | 1

Answered

If else problem for year

All of those if-elseif blocks make the code difficult to read, and difficult to debug as well. I would advise against that appr...

If else problem for year

All of those if-elseif blocks make the code difficult to read, and difficult to debug as well. I would advise against that appr...

1 month ago | 0

| accepted

Answered

Please how can I store all my matrix?

Maybe use a cell array: channel{i} = [importdata(location)]; Then at the end you can work with the individual matrices as chan...

Please how can I store all my matrix?

Maybe use a cell array: channel{i} = [importdata(location)]; Then at the end you can work with the individual matrices as chan...

1 month ago | 1

| accepted

Answered

Fast Elementwise Matrix-Multiplications

The element-wise times operation in MATLAB is already multi-threaded. You are not going to beat it by writing your own low leve...

Fast Elementwise Matrix-Multiplications

The element-wise times operation in MATLAB is already multi-threaded. You are not going to beat it by writing your own low leve...

1 month ago | 0

Answered

Defining velocity over particular time frame

You don't need a loop for the velocity. Assuming I understand that you want the velocity to be linear, you just need a vector t...

Defining velocity over particular time frame

You don't need a loop for the velocity. Assuming I understand that you want the velocity to be linear, you just need a vector t...

1 month ago | 0

| accepted

Answered

Converting C++ bits packed int** to MATLAB unisgned char mxArray using mex?

Some issues: 1) The signature of mxCreateNumericArray according to the doc is: mxArray *mxCreateNumericArray(mwSize ndim, cons...

Converting C++ bits packed int** to MATLAB unisgned char mxArray using mex?

Some issues: 1) The signature of mxCreateNumericArray according to the doc is: mxArray *mxCreateNumericArray(mwSize ndim, cons...

1 month ago | 0

| accepted

Answered

Find an optimal solution for a linear system with two inequations

The way you have this problem posed, and assuming by "binary" you mean integer, it can be solved by simple inspection. The max ...

Find an optimal solution for a linear system with two inequations

The way you have this problem posed, and assuming by "binary" you mean integer, it can be solved by simple inspection. The max ...

1 month ago | 0