Community Profile

photo

James Tursa


Last seen: Today
3.585 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.

Contact

James Tursa's Badges

  • Revival Level 3
  • Master
  • Personal Best Downloads Level 3
  • First Review
  • 5-Star Galaxy Level 5
  • First Submission
  • 36 Month Streak
  • Thankful Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

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://...

5 días 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...

5 días 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) ...

5 días 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 ...

5 días 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...

11 días 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 ...

12 días 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...

12 días 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.

12 días 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...

13 días 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...

14 días 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...

17 días 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...

18 días 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...

19 días ago | 0

Answered
reshape loop resulted cell array
result = cell2mat(c1(:))';

24 días 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

24 días 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')...

24 días 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/...

25 días ago | 1

Answered
Reshaping a complex 3D array into 1D, and back
I suspect the problem may be that you originally put the data into rows of a matrix. This separates the elements in memory. I....

25 días ago | 0

Answered
Problem with function handle
f by itself is just a function handle, not the function handle evaluated for any input. You need to give f an input. E.g., b=...

25 días ago | 1

| accepted

Answered
How can I find all possible combinations of rows from two separate arrays?
E.g., For arbitrary values in A and B, doesn't have to be B = -A n = size(A,1); C = repmat({A},2^n,1); mask = dec2bin((0:(2^n...

26 días ago | 0

Answered
Velocity,Acceleration,Angle
This is a dynamics class. Dynamics involves derivatives. How can you be in a dynamics class without knowing calculus and how t...

26 días ago | 1

| accepted

Answered
Randi(imax,m,n)
The point is that once the eps of the max value is greater than 1, you cannot represent contiguous sets of integer values in dou...

26 días ago | 2

Answered
How this code works and why for? What action does this code take?
You could look here: https://en.wikipedia.org/wiki/Bubble_sort

26 días ago | 1

Answered
Creating all possible combination of a letter/string
One way to create a matrix of these character strings: dem_a='ABC'; % assume starting string is all upper n = numel(dem_a); r...

26 días ago | 0

| accepted

Answered
Implementation of a matrix
You haven't told us what x and e are, but assuming x is a vector and e is a scalar, simply this: result = cos( (1:n) .* x(:) * ...

27 días ago | 4

| accepted

Answered
Array indices must be positive integers or logical values.
n = 0 and then you use it as an index: n=0; for i=n:1:tam-1 if xi(n)*xi(n+1)<0 You can't have a 0 index. Also, min is t...

alrededor de 1 mes ago | 0

Answered
Formatting floating and integer signed numbers
sprintf("%0.2f%+0.2f",a,b) Having the + inside the %format stuff forces the sign to print.

alrededor de 1 mes ago | 0

| accepted

Answered
For-loop in MATLAB
You should not modify the index variable i inside the loop: for i = 1:length(Corr_vector) : i=i+44; % this is ba...

alrededor de 1 mes ago | 0

Answered
Finding All Combinations of Elements in a Vector
N = 6; result = dec2bin((0:(2^N-1))') - '0'; Then the various vectors you want are the rows of result. Or, if you really want...

alrededor de 1 mes ago | 1

| accepted

Answered
About floating point format
The 64-bit floating point format is IEEE double: https://en.wikipedia.org/wiki/Double-precision_floating-point_format The 32-b...

alrededor de 1 mes ago | 0

Load more