2,895 total contributions since 2018

Communication through MATLAB is always better than arguing.

Answered

How does Matrix(3002:2001:1999998)=0.4 works?

Matrix = [1:3;4:6;7:9] Matrix(1:2:end) = 0 % I suggest you to read about MATLAB indexing

How does Matrix(3002:2001:1999998)=0.4 works?

Matrix = [1:3;4:6;7:9] Matrix(1:2:end) = 0 % I suggest you to read about MATLAB indexing

4 hours ago | 0

Answered

How to run a for-loop multiple times?

for k=1:100 for ... % some operation end end

How to run a for-loop multiple times?

for k=1:100 for ... % some operation end end

7 hours ago | 0

Answered

How to create an Array of vectors ??

Use a cell array as Stephen suggests: v1=1:3; v2=2:9; v3=2; A={v1;v2;v3}

How to create an Array of vectors ??

Use a cell array as Stephen suggests: v1=1:3; v2=2:9; v3=2; A={v1;v2;v3}

23 hours ago | 0

Answered

Undefined function or variable 'imtile'. is ti belongs to any toolbox?

<https://in.mathworks.com/help/matlab/ref/imtile.html> - *released in 2018b*

Undefined function or variable 'imtile'. is ti belongs to any toolbox?

<https://in.mathworks.com/help/matlab/ref/imtile.html> - *released in 2018b*

1 day ago | 0

Answered

Input function does not display the command in command window

Looks like you have made a file named *input.m* remove it from the path or rename it.

Input function does not display the command in command window

Looks like you have made a file named *input.m* remove it from the path or rename it.

1 day ago | 0

| accepted

Answered

Collecting the outputs of a function within a for loop

time = 100; [A,B,C,D]=deal(cell(100,1)); % if the outputs are scalars then use zeros() instead of cell for ii=1:time [A{i...

Collecting the outputs of a function within a for loop

time = 100; [A,B,C,D]=deal(cell(100,1)); % if the outputs are scalars then use zeros() instead of cell for ii=1:time [A{i...

1 day ago | 0

Answered

Extracting intervals from an array to create a new array

sum(reshape(array,[],5),2)

Extracting intervals from an array to create a new array

sum(reshape(array,[],5),2)

1 day ago | 0

Answered

Undefined function 'synchronize' for input arguments of type 'double'

https://in.mathworks.com/help/matlab/ref/timetable.synchronize.html#bvdhiyk_seealso - released in 2016b

Undefined function 'synchronize' for input arguments of type 'double'

https://in.mathworks.com/help/matlab/ref/timetable.synchronize.html#bvdhiyk_seealso - released in 2016b

1 day ago | 0

Answered

How to find out whether there is a repetitive element in the columns of a matrix?

Repetitions_in_columns=true(size(a,2),1); for k = 1:size(a,2) Repetitions_in_columns(k)=any(sum(a(:,k)==unique(a(:,k)).')>...

How to find out whether there is a repetitive element in the columns of a matrix?

Repetitions_in_columns=true(size(a,2),1); for k = 1:size(a,2) Repetitions_in_columns(k)=any(sum(a(:,k)==unique(a(:,k)).')>...

2 days ago | 1

| accepted

Answered

matrix must agree how do i fix this

N has 13 values and theta has 7 values they should have same number of elements , you maybe interested in using linspace() for t...

matrix must agree how do i fix this

N has 13 values and theta has 7 values they should have same number of elements , you maybe interested in using linspace() for t...

2 days ago | 0

| accepted

Answered

how to change every value not equal to X in every rows

Wanted = zeros(size(matrix)); indices=sub2ind(size(matrix),1:size(matrix,1),Vector); Wanted(indices)=matrix(indices)

how to change every value not equal to X in every rows

Wanted = zeros(size(matrix)); indices=sub2ind(size(matrix),1:size(matrix,1),Vector); Wanted(indices)=matrix(indices)

2 days ago | 0

| accepted

Answered

How do I restore a function I accidentally overrode (heaviside function)?

Simple *move* your custom made function from the path or *rename your function to some other name*.

How do I restore a function I accidentally overrode (heaviside function)?

Simple *move* your custom made function from the path or *rename your function to some other name*.

2 days ago | 0

Answered

Problem using a counter in a for loop

Dg = 150;%mg Vd = 50;%L ka = 1.6;%h^-1 ke = 0.4;%h-1 t=1:0.1:24; C=zeros(size(t)); for k=1:numel(t) % loop f...

Problem using a counter in a for loop

Dg = 150;%mg Vd = 50;%L ka = 1.6;%h^-1 ke = 0.4;%h-1 t=1:0.1:24; C=zeros(size(t)); for k=1:numel(t) % loop f...

2 days ago | 0

Answered

Array of same characters using any method (via loop method or any method)

Use *repelem()* or *repmat()*

Array of same characters using any method (via loop method or any method)

Use *repelem()* or *repmat()*

2 days ago | 0

Answered

how to create a text file ?

*dlmwrite()* you will find similar functions in the documentations.

how to create a text file ?

*dlmwrite()* you will find similar functions in the documentations.

3 days ago | 0

Answered

Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.

Note: Don't name your function set() will shadow the in-built function set(). sol=fsolve(@set1,[1,-1]) function F=set1(x) V...

Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.

Note: Don't name your function set() will shadow the in-built function set(). sol=fsolve(@set1,[1,-1]) function F=set1(x) V...

4 days ago | 0

| accepted

Answered

Find index of a matrix of values into another matrix

Indices = cell(numel(A),1); for k = 1:numel(A) Indices{k} = find(B(k,:)==A(k)); end %celldisp(Indices) % Indices{1} rep...

Find index of a matrix of values into another matrix

Indices = cell(numel(A),1); for k = 1:numel(A) Indices{k} = find(B(k,:)==A(k)); end %celldisp(Indices) % Indices{1} rep...

4 days ago | 0

| accepted

Answered

How do I get the mean of always 4 columns

AA=permute(reshape(A.',4,1,[]),[2,1,3]); % where A is size 527040 X 16 AAA=squeeze(mean(AA)); % if you want to reshape it as ...

How do I get the mean of always 4 columns

AA=permute(reshape(A.',4,1,[]),[2,1,3]); % where A is size 527040 X 16 AAA=squeeze(mean(AA)); % if you want to reshape it as ...

4 days ago | 0

| accepted

Answered

How to sum spesific numbers in an array?

A=[1 2 1 1 0 2 2 0 0 2 1 0 2 1 1 0 0]; y = cumsum(A==0 | [true,A(1:end-1)==0]); B = accumarray(y(:),A(:)).' C=nonzeros(B).' ...

How to sum spesific numbers in an array?

A=[1 2 1 1 0 2 2 0 0 2 1 0 2 1 1 0 0]; y = cumsum(A==0 | [true,A(1:end-1)==0]); B = accumarray(y(:),A(:)).' C=nonzeros(B).' ...

4 days ago | 0

| accepted

Answered

how many times specific number repeated in cell

Note: You have a mistake in your desired result 11 appears once. v=[B{:}]; % assuming each contents of B is a vector if not mak...

how many times specific number repeated in cell

Note: You have a mistake in your desired result 11 appears once. v=[B{:}]; % assuming each contents of B is a vector if not mak...

4 days ago | 0

| accepted

Answered

Is there any built-in function to make a matrix having non-zero entries in reverse diagonal only?

flip(a)

Is there any built-in function to make a matrix having non-zero entries in reverse diagonal only?

flip(a)

4 days ago | 0

| accepted

Answered

Convert integrand to a function in a loop

<https://in.mathworks.com/matlabcentral/answers/456430-convert-integrand-to-a-function-in-a-loop#comment_694182>

Convert integrand to a function in a loop

<https://in.mathworks.com/matlabcentral/answers/456430-convert-integrand-to-a-function-in-a-loop#comment_694182>

4 days ago | 0

| accepted