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

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

7 years ago | 0

Answered
Array of same characters using any method (via loop method or any method)
Use *repelem()* or *repmat()*

7 years ago | 0

| accepted

Answered
how to create a text file ?
*dlmwrite()* you will find similar functions in the documentations.

7 years ago | 0

Answered
how to average data /6 rows ?
mean(reshape(data,6,[]))

7 years ago | 0

Answered
Concatenate a column of cells into a single array
cell2mat(X)

7 years ago | 0

| accepted

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

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

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

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

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

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

7 years ago | 0

| accepted

Answered
create matrix from string name
<https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval> - use cell o...

7 years ago | 0

Answered
Creating new matrix from existing matrix
matrix(2:end,2:end)

7 years ago | 2

| accepted

Answered
select specific row in a matrix
B(ismember(B(:,1),A),:)

7 years ago | 0

| accepted

Answered
How i can generate a random matrix in the interval [0,100]
<https://in.mathworks.com/help/matlab/ref/randi.html>

7 years ago | 0

Answered
confusion in cat command
3 represents that the contents of A concatenated in 3rd dimension hence creating a 3D matrix.

7 years ago | 0

Answered
For loop to while loop
i=0; while i < 6 i=i+1; j=0; while j < 2 j=j+1; if ~mod(i,2) fprintf('+') ...

7 years ago | 0

Answered
set some values to zero in a matrix
Note: Have the same doubt as sir Walter but see if the below answer does what you want. [~,I]=mink(a,3,2); % requires 2017 ...

7 years ago | 0

Answered
skipping elements of a row vector
idx=reshape(1:200,10,[]); % a is your row vector sum(a(idx(:,1:2:end)))

7 years ago | 0

Answered
how to generate all the values within the range of 1:4.5
(4.5-1)*rand(10,1)+1

7 years ago | 0

Answered
if function for array
abs(A)

7 years ago | 0

| accepted

Answered
Remove repeated numbers in series
Try this: ii = [find(x(1:end-1) ~= x(2:end)) numel(x)]; l = diff([0 ii]); % just as a bonus but can be neglected if your not ...

7 years ago | 0

Answered
Row & Column Operations in table
varfun(@(x)x+1,T) % where T is your table

7 years ago | 0

| accepted

Answered
How do i fill a table with strings
array2table(a) % where a is 45 X 5 string array

7 years ago | 0

| accepted

Answered
Vectors seen as a combination of other vector's elements
[X,Y,Z]=meshgrid(a,b,c); [X(:),Y(:),Z(:)]

7 years ago | 0

Answered
How to make for 'for loop' to put values of one column matrix to other column matrix at particular location?
B = zeros(b2,1); B((numel(P):-1:1)*3-2)=P(end:-1:1)

7 years ago | 0

| accepted

Answered
find the values ​​in the row and column of the matrix by using the loop
datas=dlmread('Mymatrix.txt'); x=datas(:,1); y=datas(:,2);

7 years ago | 0

Answered
Find NaN in a cell array and only delete the NaNs
C(cellfun(@(x)any(isnan(x)),C))=[]

7 years ago | 1

Load more