Answered

I want to repeat every element of a column array (10rows,1column) four times, and put all together in one column array.. please suggest any method

repelem(t, 4)

I want to repeat every element of a column array (10rows,1column) four times, and put all together in one column array.. please suggest any method

repelem(t, 4)

etwa 3 Jahre ago | 1

Answered

How do you start a new column for every iteration in a loop?

If |data| is a 2-dimensional array then |percent_correct| is a scalar so you need to make sure it is saved in one exact place in...

How do you start a new column for every iteration in a loop?

If |data| is a 2-dimensional array then |percent_correct| is a scalar so you need to make sure it is saved in one exact place in...

etwa 3 Jahre ago | 0

| accepted

Answered

Convolution of matrix rows with while loop

Avoiding the |var1,var2|, etc. naming is good practice. In case you only need the last one, it would be fairly simple. This woul...

Convolution of matrix rows with while loop

Avoiding the |var1,var2|, etc. naming is good practice. In case you only need the last one, it would be fairly simple. This woul...

etwa 3 Jahre ago | 0

Answered

create a matrix from a matrix x=[-2 -1 0 1 2]; which follow quadratic equations

x = [-2:2]; y = [2:-1:0]; bsxfun(@power, x', y)

create a matrix from a matrix x=[-2 -1 0 1 2]; which follow quadratic equations

x = [-2:2]; y = [2:-1:0]; bsxfun(@power, x', y)

etwa 3 Jahre ago | 0

| accepted

Answered

How to break a number down into 4 squares

Such a breakdown (each output number should be at most the half of the previous one) does not always exist, take |23| for exampl...

How to break a number down into 4 squares

Such a breakdown (each output number should be at most the half of the previous one) does not always exist, take |23| for exampl...

etwa 3 Jahre ago | 1

Answered

Saving function variables without evil eval

How about having all these state variables in a struct in the first place? Then you can save them to a mat file, for example: ...

Saving function variables without evil eval

How about having all these state variables in a struct in the first place? Then you can save them to a mat file, for example: ...

etwa 3 Jahre ago | 0

Answered

Plot will not work

|nums(1,2)| is one particular element in your |nums| array, hence |t| will be |1|, and you'll end up plotting a single point.

Plot will not work

|nums(1,2)| is one particular element in your |nums| array, hence |t| will be |1|, and you'll end up plotting a single point.

etwa 3 Jahre ago | 0

| accepted

Answered

How to creat a four dimentional (from a vector) matrix and reset it's 'lower triangle'

<https://uk.mathworks.com/help/matlab/ref/permute.html permute>

How to creat a four dimentional (from a vector) matrix and reset it's 'lower triangle'

<https://uk.mathworks.com/help/matlab/ref/permute.html permute>

etwa 3 Jahre ago | 0

Answered

I am getting error with"Matrix dimensions must agree" for following code,please let me know where I am doing wrong?

The problem is here: k3/Qc Looks like |Qc| gets its value from global variable |u| which seems to be a non-scalar. So it...

I am getting error with"Matrix dimensions must agree" for following code,please let me know where I am doing wrong?

The problem is here: k3/Qc Looks like |Qc| gets its value from global variable |u| which seems to be a non-scalar. So it...

etwa 3 Jahre ago | 0

| accepted

Answered

Hi, I wanted to get a quick look over for my program see if there were any flaws.. I think it's complete. specifications and program in link thanks..

The random sample comes from a normal instead of a uniform sample (assuming U stands for uniform). Also all the data you generat...

Hi, I wanted to get a quick look over for my program see if there were any flaws.. I think it's complete. specifications and program in link thanks..

The random sample comes from a normal instead of a uniform sample (assuming U stands for uniform). Also all the data you generat...

etwa 3 Jahre ago | 0

| accepted

Answered

Replacing small sections of a logical vector

There are a few different ways to do it. This method may be frowned upon, but it nonetheless produces the required output: ...

Replacing small sections of a logical vector

There are a few different ways to do it. This method may be frowned upon, but it nonetheless produces the required output: ...

etwa 3 Jahre ago | 0

Answered

Plot based on bins with binary data

This would do the trick if you bin them from |0| to |max(stimDuration)|: n = 2; % number of bins bar(splitapply(@(x) sum...

Plot based on bins with binary data

This would do the trick if you bin them from |0| to |max(stimDuration)|: n = 2; % number of bins bar(splitapply(@(x) sum...

etwa 3 Jahre ago | 1

| accepted

Answered

question on using parfor

The error message refers to the variable classification when using parfor: <https://uk.mathworks.com/help/distcomp/classificatio...

question on using parfor

The error message refers to the variable classification when using parfor: <https://uk.mathworks.com/help/distcomp/classificatio...

etwa 3 Jahre ago | 1

| accepted

Answered

Boolen logic operations between integer numbers

>> logical(3) ans = 1 >> logical(-4) ans = 1 So 1 && 1 = 1, according to the <https://uk.mat...

Boolen logic operations between integer numbers

>> logical(3) ans = 1 >> logical(-4) ans = 1 So 1 && 1 = 1, according to the <https://uk.mat...

etwa 3 Jahre ago | 1

| accepted

Answered

Finding sum of all the elements in a row corresponding to an element which is less than a certain value?

a = [1 0 3; 9 1 5; 6 0 9; 2 4 6; 5 2 0]; sum(sum( a(a(:,1)<3, 2:3) )) a(:,1)<3 created a binary vector to indicate which...

Finding sum of all the elements in a row corresponding to an element which is less than a certain value?

a = [1 0 3; 9 1 5; 6 0 9; 2 4 6; 5 2 0]; sum(sum( a(a(:,1)<3, 2:3) )) a(:,1)<3 created a binary vector to indicate which...

etwa 3 Jahre ago | 1

| accepted

Answered

Cut differently odd and even rows in matrix

n = size(a, 2); % number of columns a(1:2:n,:) = a(1:2:n,[[3:n],[1:2]]); % move first 2 elements in odd rows to the end ...

Cut differently odd and even rows in matrix

n = size(a, 2); % number of columns a(1:2:n,:) = a(1:2:n,[[3:n],[1:2]]); % move first 2 elements in odd rows to the end ...

etwa 3 Jahre ago | 0

| accepted

Answered

How to convert a 3x3xN matrix to a N element cell array?

% a is your 3*3*N array c = mat2cell(a,3,3,ones(1,N)); c = c(:);

How to convert a 3x3xN matrix to a N element cell array?

% a is your 3*3*N array c = mat2cell(a,3,3,ones(1,N)); c = c(:);

etwa 3 Jahre ago | 1

| accepted

Answered

Problems running a function in a for loop and dynamically assigning to a struct

Thought I'd add an 'Answer' to make this question 'answered' instead of the comments. The loop fails eventually due to the HF...

Problems running a function in a for loop and dynamically assigning to a struct

Thought I'd add an 'Answer' to make this question 'answered' instead of the comments. The loop fails eventually due to the HF...

etwa 3 Jahre ago | 1

| accepted

Answered

Undefined function 'mtimes' for input arguments of type 'struct'.

This gave me a different error in the first loop: Undefined operator '+' for input arguments of type 'struct'. Which is ...

Undefined function 'mtimes' for input arguments of type 'struct'.

This gave me a different error in the first loop: Undefined operator '+' for input arguments of type 'struct'. Which is ...

etwa 3 Jahre ago | 0

Answered

How to access specific rows (or columns) of a file data without loading all data?

If you're using a .mat file and 'rows (or columns)' refer to an array stored in that file, then the doc helps: <https://uk.math...

How to access specific rows (or columns) of a file data without loading all data?

If you're using a .mat file and 'rows (or columns)' refer to an array stored in that file, then the doc helps: <https://uk.math...

etwa 3 Jahre ago | 0

Answered

Generating a random symmetric matrix

A = randi(2,N,N) - 1; A = A - tril(A,-1) + triu(A,1)'; This will copy the upper triangle to the lower triangle.

Generating a random symmetric matrix

A = randi(2,N,N) - 1; A = A - tril(A,-1) + triu(A,1)'; This will copy the upper triangle to the lower triangle.

etwa 3 Jahre ago | 3

| accepted

Answered

How to combine the name of struct together

Data.(k)(i).somethingelse = your_value See the <http://uk.mathworks.com/help/matlab/matlab_prog/generate-field-names-from-va...

How to combine the name of struct together

Data.(k)(i).somethingelse = your_value See the <http://uk.mathworks.com/help/matlab/matlab_prog/generate-field-names-from-va...

etwa 3 Jahre ago | 1

| accepted

Answered

Error using table (line 253)

Did you check how Mode looks like? It is a row array with 2 elements, which is not compatible with the 3-element column vectors ...

Error using table (line 253)

Did you check how Mode looks like? It is a row array with 2 elements, which is not compatible with the 3-element column vectors ...

etwa 3 Jahre ago | 0

Answered

Minimum in a matrix! and its location

There is no need to loop through the rows, you can specify the 'by-dimension' minimum like this: a = [ 1 2 3 0; 7 5 4 6; 9 ...

Minimum in a matrix! and its location

There is no need to loop through the rows, you can specify the 'by-dimension' minimum like this: a = [ 1 2 3 0; 7 5 4 6; 9 ...

etwa 3 Jahre ago | 1

| accepted

Answered

random vector containing zero and values

A(1:6)=0; N = 6; b = randi(N); C =(1:b); A_idx = randperm(N, b); % generate b random integers from 1 to N C_idx = randper...

random vector containing zero and values

A(1:6)=0; N = 6; b = randi(N); C =(1:b); A_idx = randperm(N, b); % generate b random integers from 1 to N C_idx = randper...

etwa 3 Jahre ago | 1

Answered

Convert contents of array into index

Your first code should work. l = ones(1, 10000); % make sure this is bigger than the largest index col will specify col ...

Convert contents of array into index

Your first code should work. l = ones(1, 10000); % make sure this is bigger than the largest index col will specify col ...

etwa 3 Jahre ago | 0

| accepted

Answered

Subscript indices must either be real positive integers or logicals.

F= ... b3(X-x(1)) ... A '*' is missing: F= ... b3*(X-x(1))...

Subscript indices must either be real positive integers or logicals.

F= ... b3(X-x(1)) ... A '*' is missing: F= ... b3*(X-x(1))...

etwa 3 Jahre ago | 1

Answered

Updating of new Matlab software

Same question <https://uk.mathworks.com/matlabcentral/answers/307321-can-i-uninstall-matlab-2016a-after-installing-matlab-2016b?...

Updating of new Matlab software

Same question <https://uk.mathworks.com/matlabcentral/answers/307321-can-i-uninstall-matlab-2016a-after-installing-matlab-2016b?...

etwa 3 Jahre ago | 0

Answered

Inner matrix dimensions must agree

4*(0.985)*(5.67*10.^-8)*(TS).^3*(TT) Here according to the <https://uk.mathworks.com/help/matlab/matlab_prog/operator-prece...

Inner matrix dimensions must agree

4*(0.985)*(5.67*10.^-8)*(TS).^3*(TT) Here according to the <https://uk.mathworks.com/help/matlab/matlab_prog/operator-prece...

etwa 3 Jahre ago | 0

Answered

Filter table data by character string

November = data(11 == month(data.date),:)

Filter table data by character string

November = data(11 == month(data.date),:)

etwa 3 Jahre ago | 0

| accepted