Answered
How to define a range to iterate with gaps in between?
for k= [1:10 15:20 25:30]

10 years ago | 0

Answered
count the number of 1 in each row
A = [0 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 0 1] B=reshape(A,size(A,1),5,[]) out=sum(B,2) out=out(:,:)

10 years ago | 0

| accepted

Answered
Simulink model does not work beginner
use this <</matlabcentral/answers/uploaded_files/51354/mem.png>>

10 years ago | 1

| accepted

Answered
how to do this on matrix to change they look?
flipud(A)

10 years ago | 0

| accepted

Answered
Find common words in 2 strings
str1 = ('rabbit is eating grass near a tree'); str2 = ('rabbit is sleeping under tree'); str=intersect(strsplit(str1),strspl...

10 years ago | 1

| accepted

Answered
How to remove specific elements in a matrix
ii=[1 2 3] jj=[2 3 4] [n,m]=size(A); B=zeros(n,m-1); for k=1:n a=A(k,:); a(jj(k))=[]; B(k,:)=a end

10 years ago | 0

Answered
how to use hist in plotyy
Look at this example t=1:10 x=randi(10,1,10) y=sin(t) hist(x) hold on plotyy(nan,nan,t,y)

10 years ago | 2

| accepted

Answered
how can alter this code to select some matrix ?
X={[ 1 1 0;0 1 0;0 0 1 ], [ 0 1 0;1 1 1;1 0 0]... [1 1 1;0 1 0;1 1 0],[1 0 1;1 1 0;1 0 0]} X{2} X{4}

10 years ago | 0

| accepted

Answered
Automatic naming of matrix
This is not good, Use instead a cell array matrix{1} = [1:10]; matrix{2} = [1:20] <http://matlab.wikia.com/wiki/FAQ#How...

10 years ago | 0

| accepted

Answered
How can I convert 'file.fig' to to jpg?
Use saveas function <http://www.mathworks.com/help/matlab/ref/saveas.html>

10 years ago | 0

Answered
When I import excel data...
for k=1:3 a{k}=xlsread(sprintf('%d',k)); end a{1} a{2} a{3}

10 years ago | 1

Answered
how can I obtain the unit-ramp of a transfer function and plot it and thanks in advance
H=tf(10,[1 2 10]) t=0:0.01:10; slope=1; u=slope*t; lsim(H,u,t)

10 years ago | 1

| accepted

Answered
outputing data into a txt file
a=[25,27,24,36] b=[19,20,22,17] c=[12,34,56,33] M=[a;b;c] dlmwrite('data.txt',M)

10 years ago | 0

| accepted

Answered
How to repeat a column 20 times one below the other?
repmat(A,20,1)

10 years ago | 0

| accepted

Answered
Generate a character matrix through indexing and a for loop
top3Table(i,1:2) = Row To pre-allocate your matrix: top3Table = ones(3,2)

10 years ago | 0

Answered
colorbar tick decimal round
plot(1:10) h=colorbar t=get(h,'Limits'); T=linspace(t(1),t(2),5) set(h,'Ticks',T) TL=arrayfun(@(x) sprintf('%.2f',x),T,'u...

10 years ago | 5

| accepted

Answered
replace any nan value in the table by zero
M(isnan(M))=0

10 years ago | 0

Answered
How to select 5 rows of a data set in rolling basis
A=randi(9,20,4) n=size(A,1); for k=1:n-4 a=A(k:k+4,:); A(k:k+4,:)=a(randperm(5),:); end

10 years ago | 0

| accepted

Answered
How can I save value of a variable when calling the same function again?
Because in the first line you wrote round=0 You can declare the variable round as persistent function ------- pers...

10 years ago | 1

| accepted

Answered
index must be a positive integer or logical.
Use ./ instead of / and also you a missed a multiplication operator * h = 1./(1+i*(w*(l/r)-(1./(w*r*c))));

10 years ago | 0

Answered
How can I find unique values in column ?
[~,b]=unique(m(:,1),'stable') out=m(b,:) If you want to choose the second column randomly [~,~,c]=unique(m(:,1),'stab...

10 years ago | 1

| accepted

Answered
how to solve a polynomial equation analytically?
solve('x^3-6*x^2+9*x+4') or roots([1 -6 9 4])

10 years ago | 1

Answered
why is my plot not showing anything
landa is always a complex number.

10 years ago | 0

Answered
recognition of different cases
yesorno = input('Run the function again? (Yes/No)\n','s') Then compare upper(yesorno) with 'YES' or 'NO'

10 years ago | 0

Answered
Finding multiple roots of a polynomial
solve('x^3 - x^2 + x + x^0.5 - 10 ')

10 years ago | 0

Answered
Find x from y using a fit equation?
Use interp1 function

10 years ago | 0

Answered
How to Store ss and ls outside the loop?
k=0; for T = 1083.4:6:1458; k=k+1; syms xs xl; [xs,xl]= solve([(xs == exp((b2 * (1 - (T/a2)))/(R * T))*xl), ((...

10 years ago | 0

Answered
fall time of square wave
If y is your signal idx=strfind(y,[1 0])

10 years ago | 1

Load more