Community Profile

photo

James Tursa


2,872 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

  • 36 Month Streak
  • Thankful Level 2
  • Ace
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
what does this code represents? and why rand() has no value between parentheses?
rand() is the same as rand without the parentheses ... they both simply call the rand function with no input arguments. The beh...

20 hours ago | 0

Answered
Solve 10 system of ODEs with separate functions and time dependent factors
This isn't going to work. You can't use random values in the derivative function for ode45. The derivative calls that ode45 mak...

21 hours ago | 1

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
What is size(dist) and size(v_e)? If these are row vectors, then maybe you need to do e*e' instead to get a scalar result.

22 hours ago | 0

Answered
Loop through specific strcuture field names
As Stephen says, this is going to be slow. But maybe this syntax using dynamic field names would be useful to you: R{i}.([name...

23 hours ago | 0

Answered
Create new cell array based on entries of other cell arrays
Not sure if this will suffice for your needs, but a simple way to get the unique strings in alphabetical order: arr4 = unique([...

2 days ago | 0

| accepted

Answered
Normalizing a complex number
It is not clear what you are trying to do. You use the word "normalize" but it looks like maybe you are just trying to find the ...

3 days ago | 0

Answered
Which is more efficient: iteratively filling in a sparse matrix vs. creating a new sparse matrix every time i need to update the matrix?
Iteratively changing a sparse matrix causes the entire data set to be copied each time, so this is inherently not efficient and ...

8 days ago | 0

Answered
I have a matrix eg [1,6,3], and i have a 31*1 cell array ,each element of cell is a matrix. My problem is i wants to extract matrix from the cell position {1*1},{6*1},{3*1} and to be stored all these in separate matrices.
E.g., is this what you want? c = your 31x1 cell array v = your vector of indexes, e.g. [1,6,3] result = c(v); % extract the c...

9 days ago | 0

| accepted

Answered
Error was detected while a MEX-file was running and MATLAB is exiting because of fatal error
Can you explain what you intended with these lines for A: double **A; : A = (double**)mxGetPr(prhs[0]); If y...

9 days ago | 0

| accepted

Answered
inconsistency when comparing cell arrays with strings vs char array
This is a really good question. E.g., >> version ans = '9.4.0.813654 (R2018a)' >> strcmp("abcd","abcd") ans = logica...

15 days ago | 0

Answered
Voltage Measurement block: "do not delete this again". What is the story behind this?
Do not delete this "gain" ... not "again" P.S. Mathworks employees do have a sense of humor ... just not for this particular ca...

15 days ago | 1

| accepted

Answered
Array Indexing Logical Values
"We know that rounding the index prevents the error" So that's a big clue. "Is there a hidden decimal place not being shown to...

19 days ago | 0

Answered
Matlab crashes when i create output matrix in mex.
I haven't had much time to look at this in detail, but at first glance this stands out: void createTable(unsigned int *dataStre...

25 days ago | 0

Answered
hi everybody , i have a question please , if i have X=[1:10] and Y=[-5:5] and i want to have all the point of the plane (x,y) , what can i do in matlab to extract this point to use it
Does this do what you want? [x,y] = meshgrid(X,Y); result = [x(:),y(:)]; Then iterate over the rows of result. Or you can ju...

26 days ago | 0

| accepted

Answered
summation of sinx using summation
You are missing the alternating signs of the terms. E.g., you could put in a factor of (-1)^something to get this effect. The ...

29 days ago | 0

Answered
How to concatenate each row of a matrix into a vector ?
result = char(A+'0');

29 days ago | 1

Answered
Index exceeds the number of array elements (1)
Type the following at the command line: dbstop if error Then run your code. When the error occurs, the code will pause at that...

1 month ago | 0

Answered
How to correct "Parse" error
Don't have your function at the top of this. Put it at the end or in a separate file. E.g., t = 1; while (height ~=0) h =...

1 month ago | 0

Answered
I have a matrix (57,3600,45), how can I create matrices with (3600,45)?
Is this what you want? k = some integer index squeeze(your_matrix(k,:,:))

1 month ago | 0

Answered
Square root table without using arrays
You need to put the new line \n in appropriate places in your loops. In particular, you only need one new line \n printed once y...

1 month ago | 0

| accepted

Answered
Memory Size and Processor Speed
Yes you can run MATLAB on this. What tasks will you typically be using MATLAB for?

1 month ago | 0

| accepted

Answered
How to? - Complex numbers
E.g., for an anonymous function you need to give the input argument list first. E.g., for a generic derivative function that tak...

1 month ago | 0

| accepted

Answered
And/or between two 3d arrays
Do you mean this? sum(array1>250 & array2>170,3);

1 month ago | 0

Answered
Function in Fortran to Funciton in Matlab
function result = F0(n,x) if( n<2 ) error('bad argument n in F0') end tox=2.0/x; bkm=F00(x); bk=F01(x); for j=1:n-1 ...

1 month ago | 1

| accepted

Answered
differentiating function & getting different answer
Perhaps you are shadowing the MATLAB function diff with a function of your own. Make sure diff is pointing to the MATLAB functio...

1 month ago | 0

Answered
Invalid Syntax at '='.Possibly,a ),} or ] is missing at line 6 .
The { } formulation for blocking code is not valid MATLAB syntax. To fix this: Get rid of the open brace { Replace the close b...

1 month ago | 1

| accepted

Answered
use this vector and a mathematical expression to create the following vectors:
Yes. It works for me: >> x= [1, 2, 3, 4 ,5] x = 1 2 3 4 5 >> x1= x.*[1,128,243,64,5] x1 = 1 25...

2 months ago | 0

Answered
Extracting matrix values for an algorithm
Something like this? xy = your n x 2 array n = size(xy,1); for k=1:n % run your algorithm here with x = xy(k,1) and y = ...

2 months ago | 1

| accepted

Answered
Basic power rule ((a^b)^c = a^(b*c)) does not work
This has been discussed in this forum before. Raising complex numbers to a power is a multi-valued operation. MATLAB picks one...

2 months ago | 1

Answered
Is it possible to use logical indexing to specify between a number interval and include a value outside that interval.
E.g., Mask = ismember(str,[' ','a':'z','A':'Z']); Or using your method Mask = (65<=Ustr & Ustr<=90) | Ustr == 32;

2 months ago | 1

| accepted

Load more