Data scientist at Cohen Veterans Bioscience; Obsessive runner. Professional Interests: Predictive modeling, statistics. (I don't respond to email via author page, but will usually look at a question if you send me a link to it.)

Answered

How can i run 2 for loops at the same time?

From your reply to my comment, it seems to me that you really do only need one for loop. Instead of your for j=1:Number_samples...

How can i run 2 for loops at the same time?

From your reply to my comment, it seems to me that you really do only need one for loop. Instead of your for j=1:Number_samples...

ungefär 11 timmar ago | 0

Answered

Fibonacci.m for Fibonacci Series

This code is not really written to handle anything but a scalar input. Consider this line in the code: while i <= n What would...

Fibonacci.m for Fibonacci Series

This code is not really written to handle anything but a scalar input. Consider this line in the code: while i <= n What would...

en dag ago | 0

Answered

What is computationally intensive and could lag run time in a script?

Obviously, we can't tell without seeing your code. Look at using the code profiler.

What is computationally intensive and could lag run time in a script?

Obviously, we can't tell without seeing your code. Look at using the code profiler.

2 dagar ago | 0

Answered

xcorr different results on different computers with NaN datasets

Are the computers running the same version of MATLAB? Also, there is an xcorr function in base MATLAB. Is it possible that one ...

xcorr different results on different computers with NaN datasets

Are the computers running the same version of MATLAB? Also, there is an xcorr function in base MATLAB. Is it possible that one ...

4 dagar ago | 1

Answered

select a specific element of each matrix in a string

firstElementOfEachCellOfU = cellfun(@(x)x(1,1),U);

select a specific element of each matrix in a string

firstElementOfEachCellOfU = cellfun(@(x)x(1,1),U);

6 dagar ago | 0

| accepted

Answered

Using the find() function to find only the first number greater than the given number.

Here is one way: % The threshold number number = 2; % Your cell. (Don't name it "cell", which is a MATLAB keyword.) C = {[...

Using the find() function to find only the first number greater than the given number.

Here is one way: % The threshold number number = 2; % Your cell. (Don't name it "cell", which is a MATLAB keyword.) C = {[...

6 dagar ago | 0

Answered

Fill area between plot and the 0-line?

You can use either the fill or patch command. See the examples there for guidance.

Fill area between plot and the 0-line?

You can use either the fill or patch command. See the examples there for guidance.

6 dagar ago | 0

Answered

Finding pair values in a matrix

If my speculation in the comment above about what you want for z2 is correct, then z2 = unique(sort(z,2),'row')

Finding pair values in a matrix

If my speculation in the comment above about what you want for z2 is correct, then z2 = unique(sort(z,2),'row')

6 dagar ago | 0

Answered

A function that outputs the mean and standard deviation

The reason you are displaying 100 results is that you do not have a semicolon after this line: moy = (A(i)-M)^2 so the resu...

A function that outputs the mean and standard deviation

The reason you are displaying 100 results is that you do not have a semicolon after this line: moy = (A(i)-M)^2 so the resu...

7 dagar ago | 0

Answered

Error bars on categorical bar plot

Call errorbar with this syntax instead: errorbar(x(1),y(1),SEM(1),'k','linestyle','none'); errorbar(x(2),y(2),SEM(2),'b','line...

Error bars on categorical bar plot

Call errorbar with this syntax instead: errorbar(x(1),y(1),SEM(1),'k','linestyle','none'); errorbar(x(2),y(2),SEM(2),'b','line...

8 dagar ago | 0

| accepted

Answered

What is the variable names of c in Kruskal-Wallis test documentation?

Perhaps you did not scroll down to this section of the documentation of multcompare, which explains what the columns are.

What is the variable names of c in Kruskal-Wallis test documentation?

Perhaps you did not scroll down to this section of the documentation of multcompare, which explains what the columns are.

8 dagar ago | 1

| accepted

Answered

Counting and removing rows with the same numbers in a particular order

Pending answers to the questions in the comments, something like this will work on your input as written: A = [1234;4123;3412];...

Counting and removing rows with the same numbers in a particular order

Pending answers to the questions in the comments, something like this will work on your input as written: A = [1234;4123;3412];...

10 dagar ago | 0

Answered

combining matricies with common values

I'm not certain this is what you want, but this is my best guess: [tf,idx] = ismember(b(:,1),a(:,2)) complete = [a(idx,2) a(id...

combining matricies with common values

I'm not certain this is what you want, but this is my best guess: [tf,idx] = ismember(b(:,1),a(:,2)) complete = [a(idx,2) a(id...

14 dagar ago | 0

| accepted

Answered

how to calculate mean without considering the zero in matrix

Presumably the easiest way to do what you want is to use the nanmean function from the Statistics and Machine Learning Toolbox, ...

how to calculate mean without considering the zero in matrix

Presumably the easiest way to do what you want is to use the nanmean function from the Statistics and Machine Learning Toolbox, ...

18 dagar ago | 0

Answered

Parsing a multi cell array into character vectors to place in table

Here is a method, using regexp to identify where the separators are, and then for loops to use the separators as the "fenceposts...

Parsing a multi cell array into character vectors to place in table

Here is a method, using regexp to identify where the separators are, and then for loops to use the separators as the "fenceposts...

18 dagar ago | 0

| accepted

Answered

Distributing a cell array into another

Here is a straightforward way: A = {'Category1', 'Category2'}; B = {'Mon', 'Tues', 'Wed', 'Thurs' 'Fri', 'Sat', 'Sun'}; nA...

Distributing a cell array into another

Here is a straightforward way: A = {'Category1', 'Category2'}; B = {'Mon', 'Tues', 'Wed', 'Thurs' 'Fri', 'Sat', 'Sun'}; nA...

19 dagar ago | 0

Answered

Valid_date function

This syntax 1 <= day <= 30 does not check if day is between 1 and 30. You need to do that as two separate checks: (1 <= day) ...

Valid_date function

This syntax 1 <= day <= 30 does not check if day is between 1 and 30. You need to do that as two separate checks: (1 <= day) ...

19 dagar ago | 0

Answered

How do I create a matrix with all binary combinations?

There's an incredible obfuscated hack for this: N = 4; dec2bin(0:2^N-1)' - '0'

How do I create a matrix with all binary combinations?

There's an incredible obfuscated hack for this: N = 4; dec2bin(0:2^N-1)' - '0'

24 dagar ago | 1

| accepted

Answered

how to make a plot from my function results?

Here is an example using a for loop that calculates and plots the Gregory-Leibinz approximation to pi: n_max = 100; pi_appro...

how to make a plot from my function results?

Here is an example using a for loop that calculates and plots the Gregory-Leibinz approximation to pi: n_max = 100; pi_appro...

24 dagar ago | 0

Answered

How do i type this long equation?

It is not possible to convert that expression to valid MATLAB syntax, because you have some mismatched parentheses. Unless I ma...

How do i type this long equation?

It is not possible to convert that expression to valid MATLAB syntax, because you have some mismatched parentheses. Unless I ma...

25 dagar ago | 0

Answered

Structures with multiple, conntected anonymous functions

Are you sure that y didn't exist in the workspace when you defined the structures? Because in a fresh workspace, S.x = 3 S.y =...

Structures with multiple, conntected anonymous functions

Are you sure that y didn't exist in the workspace when you defined the structures? Because in a fresh workspace, S.x = 3 S.y =...

25 dagar ago | 0

Answered

How to reshape matrix in this way?

N = reshape(M.',2,6).'; You need to transpose first (and later back again), because the reshape command works down the columns....

How to reshape matrix in this way?

N = reshape(M.',2,6).'; You need to transpose first (and later back again), because the reshape command works down the columns....

25 dagar ago | 2

| accepted

Answered

Multiply values by the number of days in each month

C = rand(41,35,360) ; % random 3d data daysNonLeap = [31; 28; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31]; daysLeap = daysNonLe...

Multiply values by the number of days in each month

C = rand(41,35,360) ; % random 3d data daysNonLeap = [31; 28; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31]; daysLeap = daysNonLe...

26 dagar ago | 1

Answered

How do you use multiple indices to separate data and put in a structure?

I was pretty sure there was a simple vectorized way to do this, but it did not come to me right away. But then I remembered it: ...

How do you use multiple indices to separate data and put in a structure?

I was pretty sure there was a simple vectorized way to do this, but it did not come to me right away. But then I remembered it: ...

26 dagar ago | 1

Answered

How do you use multiple indices to separate data and put in a structure?

Here's one straightforward way % Make up some data and indices A = rand(3672,10); B = 1:2:600; % Preallocate the cell arra...

How do you use multiple indices to separate data and put in a structure?

Here's one straightforward way % Make up some data and indices A = rand(3672,10); B = 1:2:600; % Preallocate the cell arra...

26 dagar ago | 1

| accepted

Answered

Why Greek leters cannot be typed in legend?

What do you get if you do L = legend('EXP','CFD simulation r k-\epsilon','Inlet position','Location','Northeast'); L.Interpret...

Why Greek leters cannot be typed in legend?

What do you get if you do L = legend('EXP','CFD simulation r k-\epsilon','Inlet position','Location','Northeast'); L.Interpret...

ungefär en månad ago | 0

| accepted

Answered

fprintf to print to both file and command window

I doubt it. I'm not sure what your goal is, but it would certainly be trivial to write your own small function. Something like ...

fprintf to print to both file and command window

I doubt it. I'm not sure what your goal is, but it would certainly be trivial to write your own small function. Something like ...

ungefär en månad ago | 0

| accepted

Answered

Loops to create multiple graphs

The gross way, with dynamically named variables: CH01 = [3 5]; CH02 = [7 11]; for ii = 1:2 varString = sprintf('CH%02d...

Loops to create multiple graphs

The gross way, with dynamically named variables: CH01 = [3 5]; CH02 = [7 11]; for ii = 1:2 varString = sprintf('CH%02d...

ungefär en månad ago | 0