Answered
How to do the following in a simpler and smarter way?
C=repmat(1:21,12,1) C=C(:)' %or C=1:21; C=reshape(C(ones(12,1),:),1,[])

13 years ago | 1

| accepted

Answered
How can I extract a word from a vector, instead of a number?
Create a structure array with name and num fields. w=struct('name',{'apples' 'pears' 'melons' 'oranges'},'num',{1 2 3 0})...

13 years ago | 0

| accepted

Answered
condition checking in matlab
x=[0.1 0.2 0.3;0.4 0.5 0.6;0.7 0.8 0.9] y=zeros(size(x)) z=y; idy=x>0 & x<0.25 idz=x>0.25 & x<0.5 y(idy)=x(idy) z(idz)=x...

13 years ago | 0

Answered
How to check if all the numbers in a column of a matrix are equal and return that value
If A is your matrix idx=find(all(~diff(A))) out=A(1,idx)

13 years ago | 1

| accepted

Answered
How to check if elements of one vector are greater than other in order?
a = [2,4,6] b = [1,2,3]; idx=a>b %The result idx=1 1 1 the first |1| means |a(1) > b(1)| the second |1| me...

13 years ago | 0

Answered
how should we know the functionality of built in functions?
doc rsenc help rsenc

13 years ago | 0

| accepted

Answered
Continuous signal, Can anyone help me?
t=0:0.01:10 a1=1; a2=4; t1=1; t2=3; y=a1*heaviside(t-t1)+a2*heaviside(t-t2) plot(t,y)

13 years ago | 0

| accepted

Answered
While Loop won't work on iteration problem
*Edit* function x=reynolds(Re,x0) x=zeros(1,100) n=1 x(n)=x0; x(n+1)=(2.5*log(Re*(x0)^0.5)+0.3)^-2; while abs(x(n+1)-x...

13 years ago | 0

| accepted

Answered
i need to plot the EEG in matlab.. i have downloaded the data base which is in .txt format. bt i am unable to plot it.. plz help
Look at |freq=(1:N/2)*fs/N| ,its length is different from |PS| length

13 years ago | 1

| accepted

Answered
How to create a graph with a shaded area ?
a=8; % Rectangle width b=15; % Rectangle height n=8; % Number of stripes is equal to 2*n plot([0 a a 0 0],[0 0 b b 0],'k','...

13 years ago | 1

| accepted

Answered
How to save filenames
imwrite(~n1, n, 'png'); Will not save any file, n is not a valid file name. What does |~n1| represent?

13 years ago | 0

Answered
how to solve error mentioned in following program?
Your function is not correct. It should be function dVc=capvolt(t,Vc) dVc=100-10*Vc Save this function as capvolt.m, t...

13 years ago | 0

Answered
plotting a graph for an polinomial with exp(x)
*x.^2* instead of *x^2* x=-pi:.1:pi; y=exp(x)+x.^2; plot(x,y)

13 years ago | 0

Answered
subsetting dates in a matrix
If A is your cell array c1=cellstr(datestr(A(:,1),'dd-mm-yyyy')) idx=ismember(c1,'12-10-2012') out=A(idx,:)

13 years ago | 0

Answered
variable to output name
a=[2 4 5]; assignin('base','adams',a)

13 years ago | 0

| accepted

Answered
How can I plot a huge set of data?
By creating a new matrix A, you are increasing the memory used by Matlab. you can check the memory used by Matlab. Type mem...

13 years ago | 1

| accepted

Answered
Transform a two dimensional into a three dimensional and combine with another three dimensional array
A=randn(4,3) out=[A(:,:,ones(1,5)) zeros(4,10,5)]

13 years ago | 0

| accepted

Answered
Correctly sum image values
n=size(im); m=ones(size(xx)); avRed = sum(im(sub2ind(n,xx,yy,m)))/el; avGre = sum(im(sub2ind(n,xx,yy,2*m)))/el; avBlu = su...

13 years ago | 1

Answered
Converting a 10x10 matrix to a 100x1 vector
If A is your matrix B=A'; out=B(:) %or out=reshape(A',[],1)

13 years ago | 0

Answered
variables problem , infinite loop
format long id1=0.513709476164662 id2=0.513709476164661 id1=str2num(sprintf('%.14f',id1)) id2=str2num(sprintf('%.14f',id2))...

13 years ago | 0

Answered
How to fix code?
You can undo by typing |ctrl+z|

13 years ago | 0

Answered
Wild cards for variable names
s=whos('HCE*') out={s.name}

13 years ago | 0

| accepted

Answered
How can I use values vectors to do element-by-element indexing in a matrix?
A=[1,3,2]; B=[2,3,1]; n=max(A) m=max(B) idx=sub2ind([n m],A,B) Z=zeros(n,m) Z(idx)=1

13 years ago | 0

| accepted

Answered
Plotting of for loop
a=0.171296; b=0.856479; c=0.25; d=0.85285; k1=d/a; k2=d/c; k3=((a^2)-(b^2)+(c^2)+(d^2))/(2*a*c); k4=d/b; k5=((c^2)-(d^...

13 years ago | 2

| accepted

Answered
problem indexing a matrix from arrays
p2(sub2ind(size(p2),r,c))

13 years ago | 0

| accepted

Answered
How to programme a uitable
<http://www.mathworks.com/help/matlab/ref/uitable.html>

13 years ago | 0

Answered
imwrite with variable filename
Correct this line write_dir = strcat(ori_dir, '/', files{k},'.tif')

13 years ago | 1

| accepted

Answered
Question on covariance matrix loop
a=rand(60000,4); b=permute(reshape(a',4,30,[]),[2 1 3]); for k=1:size(b,3) s{k,1}=cov(b(:,:,k)); end out=cell2mat(s);...

13 years ago | 0

Answered
How can I center a matrix containing NaN values?
if you statistic toolbox xctr=bsxfun(@minus, x, nansum(x)/size(x, 1));

13 years ago | 0

| accepted

Load more