Answered
Delete zero columns in images
A= [ 1 0 2 3 4 ;0 0 5 4 3 ;5 0 7 6 5;3 0 4 3 0] AA=A(:,any(A))

10 years ago | 1

| accepted

Answered
writing data from a double/cell array to excel file
v=[x;y] xlswrite('file.xlsx',v)

10 years ago | 0

| accepted

Answered
Error: Inner matrix dimensions must agree. Why is this happening?
Use .* and ./ instead of * and / dutyCycle =.5 k=rand(200,1000); initialOutput=2*exp(-j*k*pi*dutyCycle).*(sin(k*pi*dutyC...

10 years ago | 0

Answered
how cretae time dependent variable in simulink matlab?
Use a clock block to generate a time.

10 years ago | 0

Answered
Maximum variable size allowed by the program is exceeded.
you can check that blanks(n) takes less memory then zros(4) a=blanks(4) b=zeros(4) whos a whos b

10 years ago | 0

Answered
how to get the x axis label from figure handle?
a=findobj(h,'type','axe') x=get(get(a,'xlabel'),'string')

10 years ago | 0

| accepted

Answered
How do I get the workspace window back?
You can get back the default layout by: desktop = com.mathworks.mde.desk.MLDesktop.getInstance; desktop.restoreLayout('Def...

10 years ago | 96

Answered
How to find a constant
You don't need Matlab for that k=y/(e^(x/25) - 1) %or with Matlab k=solve('y == k*(e^(x/25) - 1)','k')

10 years ago | 0

Answered
Function return multiple variables
Call the function like this [x, y, t] = IVP(c)

10 years ago | 22

| accepted

Answered
How do I plot X = 0 and X = 1/2?
x1=0.5*ones(1,10) x2=zeros(1,10) y=linspace(-10,10,numel(x)) plot(x1,y,x2,y,'linewidth',2)

10 years ago | 0

Answered
Functions returns variable values at each iteration
U=[]; for t=0:1:30 f=[1.2*x-0.6*x*y;0.3*x*y-0.8*y]; u=[x;y]; w=u+h*f; U=[U w]; x=w(1); y=w(2...

10 years ago | 0

| accepted

Answered
Subscript indices must either be real positive integers or logicals error,
Try this clear sin r=10; z=0:0.1:4*pi; x=r*(z-sin(z)) Probably sin was used as a variable in a previous program

10 years ago | 1

| accepted

Answered
How can I read a 3 D 256*256*256 image file(.mat extension) ?
To read a mat file, use load function im=load('brain')

10 years ago | 0

Answered
Matrix from vectors (dynamic number of columns)
v=[1 2 3;4 5 6;7 8 9] t = [0.1 0.2 0.3] n=2 plot(t,v(:,1:n)') legend(genvarname(repmat({'Case'},1,n),'Case'))

10 years ago | 0

Answered
How to remove specific portion of the matrix?
A=[0 0 0 0 0 0 0 0 0 0 1 4 8 12 16 14 5 0 0 3 ...

10 years ago | 2

| accepted

Answered
Help with calculating median of an array without using built in function?
use n=numel(A) to get the number of element in A. If n is odd, the median will be b((n+1)/2), if n is even, try to find out.

10 years ago | 0

Answered
How do I write the matlab codes for summation of the following expressions
x_i=[6 12 18 24 30] alpha=1 beta=1 lambda=1 omega=1 F = sum(alpha*x_i.^(beta-1).*exp(-lambda*x_i.^beta))+sum((1-omega*ex...

10 years ago | 0

| accepted

Answered
How to import date time format from excel?
Use xlsread function [num,text,both]=xlsread('yourfile.xlsx')

10 years ago | 3

| accepted

Answered
Can regexprep be used for partial text replacements containing special characters?
v=importdata('file.txt') a=regexprep(v,'\<".+"\>','') b=regexp(a,'\S+','match') n=numel(b); out=[(1:n)' str2double(reshape...

10 years ago | 0

| accepted

Answered
Finding Corresponding Values In Cells
v={1 'a';2 'b';'s' 'e';1 'e' ;4 'z'} idx=cellfun(@isnumeric,v(:,1)) out=v(idx,2)

10 years ago | 0

Answered
Please help! Combine figures into one new figure
*Edit* %---------------------Generate an example--------------------------------- t=0.1:0.1:10; y=rand(numel(t),6); fo...

10 years ago | 1

Answered
Is it possible to find the difference between two impulse response
d=impulse(h1-h2)

10 years ago | 0

| accepted

Answered
how to name a data file with a variable?
q=[1 2 3] sprintf('data_qx%d_qy%d_qz%d.dat',q)

10 years ago | 0

Answered
Help for data in txt file
use unique function b=[2;3;3;1] a=unique(b)

10 years ago | 0

| accepted

Answered
How to concatenate only two planes of an image.
img = imread('ngc6543a.jpg'); red = img(:,:,1); % Red green = img(:,:,2); % Green blue = img(:,:,3); % Blue [n,m,~]=...

10 years ago | 0

Answered
Indexing a cell array according to another cell array
A = {[2,3,4],[3,6],[5,7,9,10]}; B = {[2.5,4.2,4.7],[3.2,7.4],[6.2,7.6,9.4,11.3]} idx=cellfun(@(x) x~=3 & ~(x<=9 & x>=7),A,'u...

10 years ago | 1

Answered
Pole Zero plot formation iin MATLAB
Ts=1, % sample time H=tf([0 0.44 0.362 0.02],[1 0.4 0.18 -0.2],Ts,'variable','z^-1') set(H,'variable','z') [N,D]=tfda...

10 years ago | 0

Answered
How can I number some matrices and call it later?
A=@(t) [-t , sin(t) ; t/3 , t^2] A(2)

10 years ago | 0

Answered
suptitle in 2016a
There is no a function named suptitle in Matlab. Maybe you need to use subplot command

10 years ago | 0

Answered
Trim Matrix and find the min-max value the reshaped matrix
a=A(:,1:2:end) | b=A(:,2:2:end) [ii1,jj1]=min(a) [ii2,jj2]=max(a) [xx1,yy1]=min(b) [xx2,yy2]=max(b)...

10 years ago | 1

| accepted

Load more