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

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 0

Respondida
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)

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 1

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

casi 8 años hace | 0

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

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 0

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

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

Respondida
Boolen logic operations between integer numbers
>> logical(3) ans = 1 >> logical(-4) ans = 1 So 1 && 1 = 1, according to the <https://uk.mat...

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

Respondida
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(:);

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 4

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 0

| aceptada

Respondida
Subscript indices must either be real positive integers or logicals.
F= ... b3(X-x(1)) ... A '*' is missing: F= ... b3*(X-x(1))...

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

Respondida
Filter table data by character string
November = data(11 == month(data.date),:)

alrededor de 8 años hace | 0

| aceptada

Cargar más