Answered
how to get square matrix?
f=zeros(10,1) g=zeros(1,6) r=zeros(1,5) r(1,1)=3.9805e-7 n=[Q f; g r];

13 years ago | 0

Answered
cell within a cell
A(cellfun(@isempty,A))=[] % A is your cell array

13 years ago | 0

Answered
Error assignment of elements with ode15s
A bracket is missing, it should be dc(2)=(V*B/(K + B ))*(c(1)/(km + c(1)))

13 years ago | 0

Answered
Using the text from the excel data imported
Use if strcmp(word1,'ABC')

13 years ago | 0

Answered
Which function to use for plotting a polygon with 4 coordinates ?
x=[x1 x2 x3 x4] y=[y1 y2 y3 y4 ] fill(x,y,'r') Example x=[0 2 3 2.5 1 0]; y=[0 0 1 2 2 0] plot(x,y) % to pl...

13 years ago | 1

| accepted

Answered
Error: Subscript indices must either be real positive integers or logicals
The error is in this line |dYdt(2) = (l1*(m1 + m2) - l2*m2*Y(3)*cos(Y(1) - Y(2)))/...| |(l1*l2^2*| *m2(m1* |+ m2*(sin(Y(1...

13 years ago | 0

Answered
GUIDE and selecting functions to apply on data
You can use <http://www.mathworks.com/help/matlab/ref/str2func.html str2func> function

13 years ago | 0

| accepted

Answered
does an "if does not contain operator" exist
If the input does not contain pi does not mean that the input is not in radian. Now if you want the input to contain pi ...

13 years ago | 0

Answered
finding maximum abs value of four images
[n,m]=size(im1); for k=1:n for p=1:m v=[im1(k,p) im2(k,p) im3(k,p) im4(k,p)]; [~,idx]=max(abs(v)...

13 years ago | 0

Answered
Numerically solving a system of equations, both differential and not
to solve system of nonlinear equations use <http://www.mathworks.com/help/optim/ug/fsolve.html fsolve>

13 years ago | 0

Answered
how can I remove the 'all files' option from the browse window when making GUI ?
uigetfile('*.jpg')

13 years ago | 0

| accepted

Answered
How to plot different graphs with different colours in gui axes???
Use *hold all* instead of *hold on*

13 years ago | 2

| accepted

Answered
How to solve a non linear simultaneous equation with 4 unknowns and 4 equations ?
Use <http://www.mathworks.com/help/optim/ug/fsolve.html fsolve>

13 years ago | 0

Answered
Elegant / Vectorized way of getting array from start_index vector and end_index vector?
*EDIT* v=[1 2 3 5 6 7 8 10 11 12] start_index = [1 5 10]; end_index = [3 8 12]; out=cell2mat(arrayfun(@(x,y) x:y,start_...

13 years ago | 1

| accepted

Answered
enable/disable parameter in embedded matlab function
function y=fcn(a,b,c,d) if d==1 y=a elseif d==2 y=a+b elseif d==3 y=a+b+c end %or function y=fcn(a,b,c...

13 years ago | 0

| accepted

Answered
add up a signal for every timestep
Ok, you want a cumulative sum: In your embedded function add these codes at the beginning function [☺utput,cum_outp...

13 years ago | 0

| accepted

Answered
How can I generate a continious signal? Generating a pulse?
t=0:0.001:1 y=ones(1,numel(t)) y(t>0.5 & t<0.75)=-1 plot(t,y,'r','linewidth',3)

13 years ago | 0

| accepted

Answered
how to get the matfile with a particular name
k=3 filname=sprintf('%d',k) BW = load(filename)

13 years ago | 1

| accepted

Answered
how to programm with matlab
I don't think it's possible to be an expert in Matlab programming in one year. Unless you are already an expert in other scienti...

13 years ago | 0

Answered
Reading multiple image files with Simulink
Use <http://www.mathworks.com/help/vision/ref/imagefromfile.html Image From File> block

13 years ago | 0

Answered
How to write a cylinder on a plane
height=3 radius=0.5 x_c=20 y_c=30 [X,Y,Z] = cylinder(radius) Z=Z*height X=X+x_c Y=Y+y_c mesh(X,Y,Z)

13 years ago | 0

| accepted

Answered
Create a new variable
all (['Block' == 1, 'Type' == 1]) is always false (=0)

13 years ago | 0

Answered
Sorting the name field in dir command
f= dir(filePattern); xlsfiles={f.name} xlsfiles=sort(xlsfiles)

13 years ago | 1

Answered
Extract row elements corresponding to a particular column value and save as new matrix
b=A(:,3) b(b==c)=yourvalue A(:,3)=b

13 years ago | 0

Answered
make a 2d matrix into a 3d matrix without a loop
B=repmat(A,[1,1,1024])

13 years ago | 0

Answered
delete certain elements in a matrix
A=rand(40,4) v=[1 6 11 21 26] w=sort(v); for k=0:numel(v)-1 A(w(k+1)-k,:)=[] end

13 years ago | 1

| accepted

Answered
Fast Fourier Transform Question in Matlab
You can use <http://www.mathworks.com/help/matlab/ref/sparse.html sparse> function y=rand(1,8192); yout=sparse(y) But ...

13 years ago | 0

Answered
how to plot 3d using coordinates
v1=[0.2,0.3 4 ], v2=[-0.3,0.3,0.1], v=[v2;v1]; plot3(v(:,1),v(:,2),v(:,3),'r')

13 years ago | 8

| accepted

Answered
how to feed a signal through a transfer function
You can use <http://www.mathworks.com/help/control/ref/lsim.html lsim> function N = 250; n = 0:1:N-1; x1 = 3*cos(20*pi*n/...

13 years ago | 2

| accepted

Answered
Exporting a 3D file
If A is your 3D array n=size(A,3) for k=1:n xlswrite('yourfile.xls',A(:,:,k),sprintf('sheet%d',k)) end

13 years ago | 0

| accepted

Load more