Answered
Plot shows a negative graph
Add the below two lines at the end of your code xlim([-1 1]) % if you change the scale it is clear that it starts from zero gr...

7 years ago | 2

| accepted

Answered
grouped average in arrays
Requires 2015b or later: T=table; T.Group=B.'; T.Values=A.'; G=findgroups(T.Group); avgscores=splitapply(@mean,T.Values,G)

7 years ago | 0

Answered
grouped average in arrays
Requires 2018a or later: T=table; T.Group=B.'; T.Values=A.'; G=findgroups(T.Group); groupsummary(T,'Group','mean') Note: T...

7 years ago | 0

Answered
Why won't my graph plot
Put dots in front of ^ and * (element wise operation ) since x is a vector , you will get a curve.

7 years ago | 0

Answered
How to compare 2 matrices by their values as well as it's position.
Assuming no of rows and columns of 2 matrices are equal: idx=all(a'==b',2); Match_value=a(:,idx.') Position=find(idx) % denot...

7 years ago | 1

Answered
Help with importing specific text file
Requires 2013b or later: opts=detectImportOptions('sample.txt'); T=readtable('sample.txt',opts); t=table2cell(T); idx=all(ce...

7 years ago | 0

Answered
Scaling a certain element
n=5; % certain element idx=ismember(A,n); a=A(:); a(idx)=a(idx)*3; R=reshape(a,size(A)) %OR n=5; idx=find(ismember(A,n)...

7 years ago | 0

Answered
How can i creat subvectors ?
a=[1 2 5 NaN NaN 9 0 23 12 NaN 6 2 8] index=find(~isnan(a)); idx=find([diff(index)~=1 0]); Final=mat2cell(a(~isnan(a)),1,[idx...

7 years ago | 0

Answered
How do I delete a row in a table containing certain text?
Another possibility using regexp but not as effective as the above two answers: k=cellfun(@(x)regexp(x,'Total:'),T.CalendarYear...

7 years ago | 1

Answered
Undefined funcion variable error
t=t1./Ta % you define t here z=1 Va=@(t)alfa.*exp(-(u.*t)).*(1-g.*z) - (alfa-1); % also you have a @(t)?? you have some probl...

7 years ago | 1

| accepted

Answered
Why am I getting: "Index exceeds the number of array elements (1)." error?
Euler2 (2, 4, 5, 6, 76, 10) % function call , the inputs are for an example function Euler2 (k, Ta, t0, T0, tn, n) % save ...

7 years ago | 1

| accepted

Answered
Extraction of values ​​at specified column number for each row
idx=sub2ind(size(B),(1:size(B,1)).',A); B(idx)

7 years ago | 1

| accepted

Answered
why does Matlab installer freezes at 11%?
If you are still facing problem better contact Mathworks Support Team by clicking the Contact Us button on the top right corner ...

7 years ago | 0

Answered
skip a number after every two number in for loop
L=1:10; for k = L(~ismember(L,3:3:L(end))) k end

7 years ago | 2

| accepted

Answered
How to find the derivative of a function?And then plot the derivatives?
https://www.mathworks.com/help/symbolic/diff.html https://www.mathworks.com/help/matlab/ref/fplot.html

7 years ago | 1

| accepted

Answered
"solve " function returns inaccurate solutions
fzero(@(x)x-sqrt(x+1)-sqrt(x-1),[1 5]) % ^^^----- domain %or syms x sol=vpasolve(x-sqrt(x+1)-...

7 years ago | 0

Answered
Import large numbers from text file without scientific notation
https://www.mathworks.com/help/matlab/ref/format.html

7 years ago | 0

Answered
how to get a number A which is divisible by a specific number B?
A=10; B=3; r=rem(A,B); while r~=0 A=A+1; r=rem(A,B); end A

7 years ago | 2

Answered
matching from multiple arrays
A=vertcat(a{:}); Result= 1*(any(A) & ref)

7 years ago | 2

| accepted

Answered
hi, my matlab can not show the plot. what should i do?
https://www.mathworks.com/matlabcentral/answers/234331-can-not-display-picture-in-the-figure-window-when-i-use-ploy-function?s_t...

7 years ago | 0

Answered
Plotting parameterized curve in MATLAB
doc ezplot

7 years ago | 0

Answered
How do I find a specific set of data in a matrix?
Rows_with_all_zeros=find(sum(MatrixA,2)==0) %or Rows_with_all_zeros=find(~any(MatrixA,2)) doc any

7 years ago | 1

| accepted

Answered
find mean for each 4 row in 124x7 matrix
b=mat2cell(U,repmat(4,1,size(U,1)/4)); % where U is 124 X 7 matrix R=cellfun(@(x) mean(x),b,'un',0); Result=vertcat(R{:})

7 years ago | 1

| accepted

Answered
how to write in matlab??
https://www.mathworks.com/help/matlab/ref/colon.html I suggest you to do matlab onramp course it's interactive to learn.

7 years ago | 3

Answered
Convert cell array to character array including string manipulation
Simpler: R=regexp(s,'(?<=\\)\w+(?=[.])','match'); % s is your cell array Result=string(R)

7 years ago | 0

Answered
Convert cell array to character array including string manipulation
R=cell(size(s)); % s is your cell array for k=1:numel(s) S=strsplit(s{k},{'\','.'}); R{k}=S{2}; end Result=string(R)

7 years ago | 0

| accepted

Answered
How save the image using strcat ?
doc sprintf

7 years ago | 0

| accepted

Answered
How to delete two minimum elements in a vector?
EDITED n=2; % two smallest values u=unique(A); if numel(u)==1 || numel(u)==2 Result=[] else Result=mean(A(~ismember(A,u(1...

7 years ago | 1

| accepted

Answered
Create a matrix of this type?
n=6; % number of elements in a row B=mat2cell((1:20).',repelem(1:4,2)); B=cellfun( @transpose,B,'un',0); R=cellfun( @(x) [x z...

7 years ago | 0

Answered
How to get a Scalar from a Matrix and Two Vectors
Why not the below two possible options? X*(A*Y) % A - 3 X 3 matrix , X - 3 X 1 vector , Y - 3 X 1 vector Y*(A*X)

7 years ago | 0

| accepted

Load more