Answered
How to create array from old array with values greater than a specified value?
% Some made-up data timePks = {[10; 20; 30; 40],[5; 10; 20; 25],[1; 2; 3]}; % Output with only values greater than 20 outpu...

6 years ago | 0

Answered
How to replace letters in a table column with a 1
Here is one way: % Make up a table c = {'D','unidentified','D'}'; t = cell2table(c,'VariableNames',{'ChangeMe'}) % Identif...

6 years ago | 0

Answered
Legend for grouped lines
This answer looks like it might solve your problem.

6 years ago | 0

Answered
criteria to use a while-loop
As a general rule, you will use a for loop when you know ahead of time how many iterations you want, and a while loop when you d...

6 years ago | 0

Answered
vector multiplied a matrix
If your version of MATLAB is older than R2016b, then c will not be "implicitly expanded" to the size of T. You can do the follow...

6 years ago | 1

Answered
Sort unique string/number column based on last 2 characters
Here is one way: % The guide to ordering the letter-pairs. (Although the order of the first few letter-pairs % doesn't matter,...

6 years ago | 0

| accepted

Answered
Generating a huge vector.
M = 1500; N = 76800; x = reshape(repmat(1:M,N,1),1,M*N);

6 years ago | 0

Answered
Fit methods in LME and GLME
I'm not an expert in this type of modeling. However, this section of the documentation for fitglme states that the difference is...

6 years ago | 0

| accepted

Answered
How to plot log-scale with number ?
One way is to use the semilogx function.

6 years ago | 1

Answered
How to combine multiple plots to an animation
You can use the movie command.

6 years ago | 0

| accepted

Answered
Why I cannot fit a function with more than five variables?
I think the primary problem is that some of your variables are highly correlated with each other, and therefore (a) add very lit...

6 years ago | 0

| accepted

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

6 years ago | 0

Answered
Help me with a function.
A = cumsum(B);

6 years ago | 1

| accepted

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

6 years 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.

6 years 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 ...

6 years ago | 1

Answered
select a specific element of each matrix in a string
firstElementOfEachCellOfU = cellfun(@(x)x(1,1),U);

6 years 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 = {[...

6 years 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.

6 years 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')

6 years 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...

6 years 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...

6 years ago | 1

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

6 years 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];...

6 years 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...

6 years 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, ...

6 years 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...

6 years 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...

6 years 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) ...

6 years 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'

6 years ago | 5

| accepted

Load more